PDA

View Full Version : Selection and Feedbakc in OpenGL 3



Andreas Röver
08-15-2008, 09:39 AM
Hello,

I've been scanning the openGL 3.0 spec and a lot of mails and it seems to be the plan the selection and feedback modes are removed from openGL in the near future.

My question is: how can I achieve that functionality once they are gone? For some of the removed functions the spec states the proposed replacement but there is no mention of how I am supposed to find out what is below the mouse once openGL 3.x is there. I tried to find an answer to this in several forums but I could not find anything....

Someone here can give me a hint?

Thanks a lot

Andreas

remdul
08-15-2008, 09:56 AM
This isn't something for a graphics API imo, it should never have been in GL in the first place.

You can render each object with an unique color, then read back the pixel under the mousepointer with glReadPixels. Keep in mind that the spec doesn't guarantee that the rasterized color is the exact same value you passed to glColor3f, but you can take this in account by allowing a margin.

Zengar
08-15-2008, 10:10 AM
For feedback you can use the transform feedback (render to VBO) functionality. For selection: so it yourself. There are lots of ways, like manual raycasting or using occlusion queries, or the unique-color-id as remdul suggested.

Ido_Ilan
08-15-2008, 03:32 PM
Hi,

transform feedback can be used for both things, just wrap it with your own parser for selection and feedback.

The best way to do proper selection is by ray casting and using some spatial data structure, once I've moved from OpenGL selection to my own ray casting solutions the selection became RT.

Ido