I rendered a model from the viewpoint of the light. The depth buffer contains many 1.0s except the places where my model lies. It is understandable, because the depth of the background is infinite, thus should be 1.
Now, I want to get the depth value of the points on the other side. I inserted the following statement in my code
glDepthFunc(GL_GREATER);
This time, the value in the depth buffer are all 1.0.
My explanation for this is that if OpenGL renders the background first, then the depth buffer will be filled with 1.0, obviously, all the points in the model has a depth value that is less than 1.0, so they cannot pass the depth test.
Am I right? How to get the depth value on the invisible side?