View Full Version : depth buffer,,, why and how?

03-14-2001, 12:04 AM
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:

glPixelTransferf(GL_DEPTH_SCALE, 0.1f);
glPixelTransferf(GL_DEPTH_BIAS, 0.5f);
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.