web api instance method
WebGLRenderingContext: cullFace() method
Available in workers
The WebGLRenderingContext.cullFace() method of the WebGL API specifies whether or not front-
and/or back-facing polygons can be culled.
Syntax
cullFace(mode)
Parameters
mode- : A
GLenumspecifying whether front- or back-facing polygons are candidates for culling. The default value isgl.BACK. Possible values are:gl.FRONTgl.BACKgl.FRONT_AND_BACK
- : A
Return value
None (undefined).
Examples
Polygon culling is disabled by default. To enable or disable culling, use the
enable() and
disable() methods with the argument
gl.CULL_FACE.
gl.enable(gl.CULL_FACE);
gl.cullFace(gl.FRONT_AND_BACK);
To check the current cull face mode, query the CULL_FACE_MODE constant.
gl.getParameter(gl.CULL_FACE_MODE) === gl.FRONT_AND_BACK;
// true
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.