2d, using depth as an ID

hi all,

If I want to do picking often (maybe 20 times a second) for a 2d scene, would it be better to store IDs in the depth buffer than to use the standard selection approach (a render per pick)? That is, read the ID from the depth buffer using glReadPixels? Rendering is much faster than picking in the CPU for my case.

thanks

You might consider adding an alternate render pass (which doesn’t get shown on-screen, but perhaps is overdrawn with the real render) which uses a unique color per object, so the system can query the object underneath the pixel via glReadPixels of the color buffer. I’ve been told by the NASA World Wind Java development team that they use this technique for picking in their system with good success.