I would like to implement scene picking (for mouse clicks, moves, etc.). What is the best, fastest way? I used to use glSelectBuffer
and glRenderMode
with GL_SELECT
and then render whole scene again (of course with boost, without textures, heavy shaders, etc.).
It's too slow render recursively all nodes and geometries for one number (geometry ID) on every mouse click, move and drag. Does anybody know better way?
EDIT: Solution with reading depth buffer seems fain, but what if I don't want to pick some geometries and they are already drown to buffer? Finding box which contains point can be imprecisely, since point can be in multiple boxes.
Is it possible to write into two frame buffers, depth buffers in one draw? Then I can write geometry id to one buffer through shader. And what about speed?
See Question&Answers more detail:os