unexpected depth value returned by gluUnProject
Posted on 2004-09-09
I've found the resources on the net to use gluUnProject() to get the world (x,y,z) values given a screen coordinate. The code seems to work, but I'm a little confused by the z value returned. The application renders a triangle strip in which all z values are -3.0f, but the z value returned from gluUnProject is -1.0f.
The application sets the viewport with
gluPerspective(37.0, (GLfloat)w/(GLfloat)h, 1, 20.0);
The vertices get setup with
glVertex3f( xstep, ystep, -3.0f);
Any idea why the z value isn't -3.0f?