PDA

View Full Version : Unprojecting



Ferenzzy
10-19-2005, 03:11 AM
Hi!

I am wondering about the z coordinate when unprojecting with gluUnProject. If I pass 0 as the winz coordinate it should return the point on the near clipping plane projecting to the given winx and winz. If I do



glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, width/height, 1.0, 50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
gluLookAt(0, 0, 5, 0, 0, 0, 0, 1, 0);and then unproject with winz = 0 it returns z = 0 in object coordinates. Shouldn't that be z = 4?
I think I already got that working some time ago...

Thanks for your help!