How to eliminate jagged edges ?

hi !

I’m using gl_quads to draw my objects at my 3D view they are very simple objects box, cylinder, etc … but I end up with jagged edges where two objects are intersecting. To eliminate this, enable the culling with gl_back set on, if I don’t use it then the resulting rendering is worst.

What can I do to get over this trouble.

Thnx!

I don’t really understand what your problem is (Hint: a screenshot maybe useful), but if backface culling reduces the problem, you probably forgot to turn on depth testing.

Make sure to request a depth buffer, and glEnable(GL_DEPTH_TEST). Also change your clear call to glClear(… | GL_DEPTH_BUFFER_BIT).

Another reason for “jagged edges” on depth tested faces is a limited depth buffer resolution.
Check your projection matrix. In gluPerspective, glFrustum, or glOrtho calls the ratio of zFar/zNear should be as small as possible without clipping your geometry. Push zNear out and draw zFar in to increase the depth buffer precision.
Request a 24 bit depth buffer in the pixelformat, that’s what most hardware supports best.