View Full Version : un projecting corners
10-15-2000, 01:09 AM
I want to work out what the 3d coordinates are for say the top right and bottom left corners of the window, when z = 0.
I assume glUnProject()is the right thing to use to do this, but I having trouble figuring out the winZ parameter.
If any one can shed some light on this it would be much appreciated.
Thw winz coordinate is a value ranging from 0.0 to 1.0, unless you changed it with glDepthRange, which there is no need for.
A value of 0.0 means a point on the near clipping plane, and a value of 1.0 means a value on the far clipping plane. A value between 0.0 and 1.0 means somewhere between the two clipping planes.
So, if you want to know the world coordinate of the lower left corner of the near clipping plane, you should pass (0,0,0) as the point to unproject. Two zeros first for screen coordinate (0,0) and then a zero for a point on the near plane.
use glReadPixels(... GL_DEPTH_COMPONENT?..)
to see the depth value of the pixel u wanna read and then plug that number into the gluUnProject(..) function
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.