Advanced Topics

Face Culling

Face culling is another way remove wasteful draw calls. The main idea is to discard faces of a geometry that are not pointing toward the camera or view. For example, if we have a cube, we would only see maximum 3 faces of the cube no matter from where we look at it, so why draw the entire cube?

Face culling works when having proper face winding of the geometry. That way OpenGL can discard either the front faces or back faces.

To set this up, we first need to enable it.

glEnable(GL_CULL_FACE);

That is pretty much it. We can also control which face to cull.

glCullFace(GL_FRONT);
Squared Wave SVG