On 6/24/07, Lin Yuan <[EMAIL PROTECTED]> wrote:
Hi everyone,
I use the osg::Image function readPixels to read depth buffer values like
this:
...
image->readPixels(x,y,width,height,
GL_DEPTH_COMPONENT,GL_FLOAT);
GLfloat* depth = image->data();
...
All values in "depth" are between 0.0 and 1.0. How can I get the true value
of Z coordinates? Dose OSG have any counterpart of the OpenGL function
"gluUnproject"?
How can I make it with OSG? Thanks a lot!

You can use the Camera's window, projection matrix and view matrix to
transform from window coords into object coords.

However, the most efficient way to do intersection tests are to use
PolytopeIntersector or LineSegmentIntersector and do everything on the
CPU, and round trip to the GPU to do tests is very very expensive.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to