|
//
read pixel
from the depth buffer GLfloat depth; glReadPixels(x, y,
1, 1, GL_DEPTH_COMPONENT, GL_FLOAT,
&depth); //
retrieve
depth range GLfloat depthRange[2]; glGetFloatv(GL_DEPTH_RANGE, depthRange); float nRange = depthRange[0]; float fRange = depthRange[1]; //
perspective
projection parameters const float nearClip =
1.0, farClip =
10000.0; //
compute range
based on the resulting //
depth and the
near and far clipping planes const float depthRange = fRange - nRange; const float clipRange = farClip - nearClip; const float f1 = float(fabs((farClip * nearClip
* depthRange) /
clipRange)); //
figure range
in Data Base Units float rangeDbu = float(fabs(f1 / (depth
- (((nearClip + farClip) *
depthRange)
/ (2.0f * clipRange))
- ((fRange + nRange) /
2.0f))));
[EMAIL PROTECTED] wrote:
|
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

