Hi,
I’m trying to read the depth value at a single pixel location in the framebuffer, in a simple GLUT application.
When the user clicks the mouse at pixel location (x, y), my program execs the following code:
float depth;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
For some reason, the contents of depth is always equal to 1.0, even if I click on objects that clearly have depth <1.0. Anybody know why this would be?
Thanks,
Eric