View Full Version : Automatic hidden surface removal?

04-18-2008, 05:22 PM
I have written a program that converts Bevier patches into 3-d GL_POLYGON objects (eg. 32 Bezier patches to draw a teapot which is comprised of a few thousand triangles).

Unfortunately the patches that are drawn last appear in front of the rest. This makes some interior sections of my teapot appear when they're supposed to be hidden.

Is there some automatic way to hide triangles which should not be shown? If not, what's the easiest way to do so that's not absurdly inefficient?

Thanks for the help!

04-18-2008, 07:06 PM
The z-buffer should take care of that.

glDepthFunc(GL_LEQUAL);//less or equal

I beleive it is disabled by default when you make a GL context.

04-21-2008, 03:46 PM
Also, backfaced polygons should be removed. If the depth buffer isn't helping you, your polygons might be wound backwards, causing the far side of the teapot to show and not the near side.