Trouble. I want to obtain the depth information of the current view.
But the result is not what I want.
I use the following codes:
glReadPixels(0, 0, winWidth, winHeight, GL_DEPTH_COMPONENT, GL_FLOAT, depthResults);
The result value I got at any pixel is either 0.5 or 0.6, where 0.6 means the pixel is on an object and 0.5 means empty. There are serval balls and boxes in the context.
Why the depth values on the object are all the same? It should be distributed in [0, 1]!
How can I do?
Thanks for any responses.