View Full Version : Perspective view is a mess up with depth testing.... ????

02-23-2005, 04:23 AM
Hi all!! I have a 3d scene, and when I apply an orthographic projection, depth testing occurs well, but when I apply a perspective projection, by example the triangle becomes invisible!!!
Detail: I apply camera viewing transforms, but I'm remodeling it to simple rotation/translation transforms (it is modelled only with gluLookAt)..... Could you please answer me this question, and in case of a mess up, (need to do with ortographic), do I need to do the near/far motion by glScale?? Thanks in advance!!

02-25-2005, 01:07 AM
How did you apply perspective projection? It is more likely that you use wrong projection than you problem is depth buffer related.

02-28-2005, 04:44 AM
hi! I apply perspective projection by a call to
gluPerspective(90, 1, -100, 100); By the way.... Thanks!!

02-28-2005, 05:33 AM
Of course this doesn't work. The zNear parameter in gluPerspective must be greater than zero.
Try this
gluPerspective(90.0, 1.0, 1.0, 201.0);
glTranslatef(0.0f, 0.0f, -101.0f); // Puts the origin into (zFar + zNear)/2.0