View Full Version : Z Buffer Issues

10-04-2004, 01:07 PM
Hi guys,

My previous was a bit vague so I'll try again. Here's two screenshots of some issues im having when rendering. The first shot is inside a ship mesh, the second is outside the mesh.

www.meshsoft.net/mesh1.jpg (http://www.meshsoft.net/mesh1.jpg)
www.meshsoft.net/mesh2.jpg (http://www.meshsoft.net/mesh2.jpg)

When i move the camera around, I get flickering on the edges of the triangles and when looking from the inside of the mesh, i can see lines on the edges of the polys. I'm assuming this is a Z Buffer problem, so everytime I draw i'm clearing the Z Buffer, setting clear depth to 1.0, setting the z buffer func to GL_LEQUAL, and enabling depth writing. Nothing is taking effect.

What else could it be thats affecting this? Oh, im also setting glEdgeFlag to 0 just incase that was bothering it.

10-04-2004, 01:12 PM
Debugging Notes:

Z Buffer Near: 10.0f
Z Buffer Far: 1000.0f
Z Buffer Bits: 32

This same model renders perfectly in 3D Studio MAX using the OpenGL drivers.

10-04-2004, 01:58 PM
Try setting the z buffer func to GL_LESS.


10-04-2004, 02:25 PM
No change.

I'm beginning to wonder if it really is a bad Z-Buffer problem, or could it just be bad aliasing?

10-04-2004, 02:55 PM
Did you check your polygon fill mode, stippling, dithering, etc... ?


10-04-2004, 02:57 PM
I enable GL_DITHER. I don't about the others you mentioned.

10-04-2004, 03:06 PM
I asuume the triangles are properly connected by sharing vertices using index pointers?


10-04-2004, 04:34 PM
The images don't work for me.

Do you have Polygon Smoothing enabled? If so, try turning it off.

10-05-2004, 03:09 AM
It seem's to be GL_POLYGON_SMOOTH that creates these bad lines. I found a link that discusses the problem at:


Thanks for your help.

10-06-2004, 10:57 PM
Sorry i can't open u're images, but it sounds to me like a problem i've some times ago. Reduce u're z-Buffer value down to 24Bits, most of the grafic-cards have a limited z-Buffer value in relate to the color-Buffer, perhaps this should solve u're problems...