Z Buffer Issues

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.


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.

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.

Try setting the z buffer func to GL_LESS.


No change.

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

Did you check your polygon fill mode, stippling, dithering, etc… ?


I enable GL_DITHER. I don’t about the others you mentioned.

I asuume the triangles are properly connected by sharing vertices using index pointers?


The images don’t work for me.

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

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.

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…