简体   繁体   English

深度缓冲区的绝对距离

[英]Absolute distance of depth buffer

1.How can i find the absolute distance of the depth buffer? 1.如何找到深度缓冲区的绝对距离?

2.How can I calculate the real value of the depth_bias and depth_scale? 2.如何计算depth_bias和depth_scale的实际值? I tried by the commends: 我尝试过的建议:

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

In my code I declared this values- zNear, zFar. 在我的代码中,我声明了此值-zNear,zFar。 and I decide what value to give them so they are not const.so the distance is dependent in the ZFAR,ZNEAR and the depthBufferValue(change from pixel to pixel) – 我决定给它们提供什么值,以便它们不是const.so距离取决于ZFAR,ZNEAR和depthBufferValue(逐像素变化)–

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

Near/Far clip planes values are used to construct projection matrices. 近/远裁剪平面值用于构造投影矩阵。 You should be able to see them in your code. 您应该能够在代码中看到它们。 For example: 例如:

glOrtho(left, right, bottom, top, nearVal, farVal); // <-- Last two values here
gluPerspective(fovy, aspect, zNear, zFar); // <-- Last two values here

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM