glCullFace

The glCullFace function specifies whether front- or back-facing facets can be culled.

void glCullFace(
  GLenum mode);

Parameters

  • mode
    Specifies whether front- or back-facing facets are candidates for culling. The symbolic constants GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK are accepted. The default value is GL_BACK.

Remarks

The glCullFace function specifies whether front- or back-facing facets are culled (as specified by mode) when facet culling is enabled. You enable and disable facet culling using glEnable and glDisable with the argument GL_CULL_FACE. Facets include triangles, quadrilaterals, polygons, and rectangles.

The glFrontFace function specifies which of the clockwise and counterclockwise facets are front-facing and back-facing.

If mode is GL_FRONT_AND_BACK, no facets are drawn, but other primitives such as points and lines are drawn.

The following functions retrieve information related to glCullFace:

glGet with argument GL_CULL_FACE_MODE

glIsEnabled with argument GL_CULL_FACE

Error Codes

The following are the error codes generated and their conditions.

Error code Condition
GL_INVALID_ENUM mode was not an accepted value.
GL_INVALID_OPERATION glCullFace was called between a call to glBegin and the corresponding call to glEnd.

Requirements

**  Windows NT/2000:** Requires Windows NT 3.5 or later.
**  Windows 95/98:** Requires Windows 95 or later. Available as a redistributable for Windows 95.
**  Header:** Declared in Gl.h.
**  Library:** Use Opengl32.lib.

See Also

glBegin, glDisable, glEnable, glEnd, glFrontFace, glGet, glIsEnabled