Depth, blending & cullingGL 1.0

glFrontFace

Defines which vertex order (winding) counts as a front-facing triangle.

Signature

void glFrontFace(GLenum mode);

How it works

After projection, a triangle's vertices appear on screen either counter-clockwise or clockwise. OpenGL uses this to tell front from back. The default is counter-clockwise (GL_CCW) — the convention of most modeling tools and of glTF.

012012counter-clockwise: frontclockwise: back, culled
Winding is the order the vertices appear in on screen. With the default glFrontFace(GL_CCW), the counter-clockwise triangle faces the camera; the clockwise one shows its back, and glCullFace(GL_BACK) skips it. Turning a triangle around flips its winding, which is how culling knows.

Parameters

modeGLenum

Winding of front faces.

Common values

GL_CCW
Counter-clockwise (default).
GL_CW
Clockwise.

Tips & pitfalls

  • A model that looks inside-out with culling on usually has the opposite winding — flip it here or in the exporter.

Example

example.cpp
1glFrontFace(GL_CCW);
Official Khronos documentation