WebGLRenderingContext: cullFace() method
The WebGLRenderingContext.cullFace()
method of the WebGL API specifies whether or not front-
and/or back-facing polygons can be culled.
Syntax
js
cullFace(mode)
Parameters
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
.
js
gl.enable(gl.CULL_FACE);
gl.cullFace(gl.FRONT_AND_BACK);
To check the current cull face mode, query the CULL_FACE_MODE
constant.
js
gl.getParameter(gl.CULL_FACE_MODE) === gl.FRONT_AND_BACK;
// true
Specifications
Specification |
---|
WebGL Specification # 5.14.3 |
Browser compatibility
BCD tables only load in the browser