i want to implement a color based selection feature. so i first give each object a unique color, and then i render the region under the mouse selection into a buffer and check the color of pixels to determine which object is selected.
one option of implementing this is through glReadPixels. but i don’t want to use it, because it reads from the frame buffer, which means i need to use frame buffer for the selection rendering and then restore my normal rendering back.
better if there is an off-screen rendering method, so that i don’t need to interrupt the current frame buffer.
i know frame buffer object is useful for off-screen rendering, but normally it is for generating textures. it seems that the frame buffer object is always bind with texture maps when used. i have never seen a code sample that reads the data back from a fbo.
pbuffer is said to be deprecated. so i don’t want to use that either.
so what should i do?