title: Picking with OpenGL Shading Language
body: <p>I'm trying to figure out the best way to pick informations rendered using shaders.
  A window manager buffer (the window) is used for outputting rendering. On user event I should pick the geometry rendered. Using gluPick is easy, but I'm trying to pick using only shaders.</p>
  
  <p>Flexibility of shaders doesn'y aid me to find a correct solution. I've found the following solutions:</p>
  
  <ul>
  <li>Rendering using the system provided buffer (indeed using colors). Use glScissor to limit the rendering on a certain region and use glReadPixels for fetching colors, mapped with geometry identifiers</li>
  <li>Rendering using a separate framebuffer object. Renderbuffer formats need to defined. Maybe can I use plain integers for putting names?</li>
  <li>Rendering using a framebuffer object, both for rendering and picking. An additionally renderbuffer object containing rendered names.</li>
  </ul>
  
  <p>It seems that the second solution is the best, since doesn't alterate the window buffers and it's possible to define a custom way to specify geometry names.</p>
  
  <p>Any suggestion?</p>
  
  <p>P.S:</p>
  
  <p>Since in a fragment shader i declare an array of vec4 for defining the fragment data, how I could setup a framebuffer holding an render buffer having only the R component, stored in a sized integer internal format?</p>
  
  <p>Is it possible to link a fragment shader output variable with a specific attached render buffer?</p>