opengl-tutorials / ogl

http://www.opengl-tutorial.org
2.69k stars 925 forks source link

Some comments on the Picking with an OpenGL Hack article #134

Open Haiderahandali opened 7 months ago

Haiderahandali commented 7 months ago

I am not experienced enough myself, but a person who is very experienced with OpenGL commented the following on your tutorial for mouse picking with OpenGL hack https://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-an-opengl-hack/

that article has some misinformation - you do not need glFlush or glFinish before glReadPixels also it's missing one simple optimization - glScissor to limit rasterization to 1x1 pixel or even better - setting up just 1x1 render target with adjusted camera matrix pointing to 1 pixel, so you don't need to allocate same sized RT memory as your full backbuffer

as I am only learning OpenGL, I just wanted to point those comments out, I hope they are useful. Best.