PDA

View Full Version : depth test



07-01-2003, 06:53 AM
I am rendering a scene with polygons and polylines with different z-values in unsorted orders.
I used
glEnable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT);

the polygons are rendered correctly, when they overlaps with each other the hidden surface are removed.
but the polylines are not shown correctly. for example, I have two polygons with z value -2000 and -4000,
and a polyline with z value from 0 to -6000. I have this polyline pass through the polygons. the results I expect is after some rotation, part of the polyline can be seen and part of the the polyline will be covered by polygon (polyline pass through the polygons).
but the result I got is the polygon is covering the polyline completely.

Can anybody help me?

Thanks.
jim

Relic
07-01-2003, 11:58 PM
Depth buffer precision depends on number of depth bits and zFar/zNear ratio.
Select a pixelformat which has 24 bits if you have 16 now.
Make the zFar/zNear ratio in your viewing frustum as small as possible, that is, move zNear out and draw zFar in as close as possible.