Why I can't get the depth value with glReadPixel()?
I am using an opengl rendering program to do some simulation. Unfortunately, the model redering code is not availabe. What I'm doing is first loading and rendering a model with this program, and the model can be selected and translated, then trying to get the fragment information including z-buffer for further simulation. But when I use glReadPixel() to get z-buffer, all the values are 1.0, even the fragment at the model displaying area. I know it should be between 0.0 and 1.0.
Because I don't know how the model is rendered in the program, so anyone could help what the problem is and in which rendering case the z-buffer can not be read correctly. Is there any way to get the depth value of each pixel?