0

1.如何找到深度缓冲区的绝对距离?

2.如何计算depth_bias和depth_scale的真实值?我尝试了赞扬:

glGetDoublev(GL_DEPTH_BIAS,  &depth_bias);  // (Returns only 0.00)
glGetDoublev(GL_DEPTH_SCALE, &depth_scale); // (Returns only 1.0 )

在我的代码中,我声明了这个值——zNear、zFar。我决定给它们什么值,所以它们不是常量。所以距离取决于 ZFAR、ZNEAR 和 depthBufferValue(从像素到像素的变化)——

4

1 回答 1

0
Distance = NearClipPlane + DepthBufferValue * (FarClipPlane - NearClipPlane);

近/远裁剪平面值用于构造投影矩阵。您应该能够在代码中看到它们。例如:

glOrtho(left, right, bottom, top, nearVal, farVal); // <-- Last two values here
gluPerspective(fovy, aspect, zNear, zFar); // <-- Last two values here
于 2014-03-04T05:28:26.923 回答