Ok, first, I think you have to understand some basic concepts.
Before the EXT_framebuffer_object was introduced in hardware, OpenGL disposed of only one framebuffer which is the name given to a collection of rendering destinations, like color buffer (displayed on screen), depth buffer (used to the hidden parts removal) and others like stencil buffer, accumulation buffer…
The EXT_framebuffer_object extension provide the ability to create your own framebuffer object (fbo) with attached color buffers (There could be multiple color buffers, see MRT) and depth buffer (see color and depth attachment in the link I gave above).
Color and depth buffers attached to fbo could have different natures: “Render buffer” or “texture”. Typically, you choose a texture for the color buffer if you want to sample (read) it in the end. Otherwise, choose a render buffer (Depth buffer which is rarely read is often a render buffer).
In conclusion, a fbo is like a “custom framebuffer” that you manage independently of the fixed one. All rendering operations possible with the framebuffer provided to opengl by the window system are possible in a fbo and hardware accelerated. So a fbo behaves like an unvisible framebuffer.
This is my conception a framebuffer objects, maybe you would think it is still obscure , I let people of the opengl community correct me and add precisions. Don’t hesitate to ask more questions.
What I meant was:
- draw your quads the way your are used to, in the framebuffer
- redraw your quads in a fbo, with a 2D texture as color attachment and a renderbuffer as depth attachment if needed. As i said draw quads with a uniform and single color.
- repeat 1 and 2 each time the quads or camera are moved or the window resized.
- when you detect a mouse click in the window, retrieve the coordinates of the clicked point.
- Use them as screen coordinates to read a the texture drawn with the previous fbo. Use for example, glGetTexImage.
I don’t know if it is the most efficient way to do this. You can also, not use fbo at all and do the 2) in the framebuffer in a 2nd pass when the mouse is clicked in the window area.