View Full Version : the winZ value of gluProject()
06-13-2002, 06:20 PM
when I use gluProject() to get the windows pixel coordinates, the winZ value which stands for depth is always close to 1.0 eventhough the 3D point is far from the zfar plane.
Does anybody know why? the program works fine with depth-test.
The winZ coordinate is not linearly distributed between the near and far clip planes. That means that winZ = 0.5 does not mean halfway between the near and far clip plane. The precision is closer to the near plane, which mean 0.5 is closer to the near plane than to the far plane. The amount of distribution closer to the near plane is directly linked to the position of the near and far clip planes. The greater the ratio far/near (divide the distance to the far clip plane by the distance to the near clip plane), the more distribution close to the near clip plane. If you always get numbers close to 1.0, it means you have a too large ratio. You should always push the near clip plane as far out as you can possibly accept.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.