I work in the moment on a c++ SDL/OpenGL 3D application and run into a problem with picking using glReadPixels and gluUnProject.
Everything works fin till I resize the window.
The problem is that glReadPixels don´t give me a right value for the new screen reagions. I get always the value 8.96831e-044. in this reagions. Else I get back 0.0f till 1.0f.
The rendering works fine after resize only the picking fails. The reagion from the left lower screen corner work fine. The new reagions above and right beside don´t work.
Yes everythings ok.
depth test is enabled.
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); called in render function.
Picking is after the rendering.
I search for this now over 5 houres…
Hope someone have a hint that helps.
Your code looks fine to me. My suspicion is probably some code path is modifying you modelview/projection matrices. Could u recheck using debugger whether these matrices have their original values?