Depth buffer problem ?

1.)I have a really simple program displaing 2 triangles but it won’t display them if the z-coordinates are higher than 0 even when I set depth buffer


Where is the problem ?

2.)How can I set the screen coordinates ? I don’t want to use floating point numbers frequently(-1,1,-1,1,-1,1).glOrtho doesn’t seem to work

  1. You seem to be setting the perspective up wrong. I can’t say for sure without more code.

  2. I belive you want the gluUnproject(…) procedure.

  • Halcyon

Use negative values of z to move objects further to front, you wont see positive values (with Projection) there is a different story with Ortho though. Anyway

As I know 0 on z axis should be displayed(and it is)but in case the object is not rotated then it is shown only once then disappers whats wrong with that ?