PDA

View Full Version : Single-sided triangles



skippyj777
08-21-2000, 09:01 AM
Why does OpenGL always render double-sided triangles? How can I get it to render a single-sided triangle?

BwB
08-21-2000, 01:18 PM
glEnable( GL_CULL_TEST ) for starters.. then it only matters wether or not you specify your verticies in clockwise or counter clockwise order (unless they have a normal too) I dont remember which why openGL defaults to culling, but I know you can change it with one of the nifty function calls. Check the redbook, it can be found online (check one of the more recent posts with that title).
I'd suggest starting by just enabling the cull test and see what happens, if the wrong side of the triangles are visible, then reverse the order in which you specify them (vert1, vert2, vert3 -> vert1, vert3, vert2)
Hope that helps http://www.opengl.org/discussion_boards/ubb/smile.gif

-BwB

Bob
08-22-2000, 01:51 AM
BwB wrote >> then it only matters wether or not you specify your verticies in clockwise or counter clockwise order (unless they have a normal too)

The normal has nothing to do wether the face is culled or not. The actuall culling is performed by determining in which order they appear on the screen. By default, if the order is couterclockwise on the screen, then the face is considered visible.

Frontfacing polygons are set with glFrontFace(mode) where mode is GL_CW or GL_CCW.

Which face to remove is set with glCullFace(mode) where mode is GL_FRONT, GL_BACK or GL_FRONT_AND_BACK.