Bad jagged edges on all objects

Working on a modeler program and the edges of most blocks show a bad triangular repeating distortion where the block behind it shows through.

I figured out that the depth buffer seems to have a very low accuracy and made some improvements by setting it to Equal or Less rather than less. I have it set for 32 bit and have tried different ranges, which doesn’t seem to have an effect.

The problem occurs where two rectangular shapes meet. They are flush with common points but the back object shows through in a weird and sometimes large repeaeting pattern.
And always shows as cracks of the material on the block behind. Drawing order helps a little with the Equal or Less, but not much.

I’m obviously missing something.

Any suggestions on what to try, or can someone tell me what the problem is?


Does it help to set the near clipping plane a bit higher ? if you have a near clipping plane close to zero you might have nasty artifacts.


Thank you VERY much!

I had the near plane in the perspective windows set to 1.0 and was getting up to 10 pixel wide jaggies. At 5 they are down to 2 or 3 pixels and with 10.0 everything is single pixel like it should be.

OpenGl has been a lot of fun to work with (I’m new to OpenGl, but not 3D systems. The last time I tried a 3D display program was pre-OpenGl and you had to write all your own display code - mine wasn’t fast enough) amd I’ve been able to bang around and figure out most of the problems I’ve run into, but I was looking in the wrong place for this one!

I’m very glad to find an OpenGl developer forum!

Thanks again for the wonderfully correct tip!


It would be nice if there was a good and simple way to dynamically change the z-buffer
clipping planes.