WebGLRenderingContext.depthFunc()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
WebGL API 的 WebGLRenderingContext.depthFunc()
方法,指定将输入像素深度与当前深度缓冲区值进行比较的函数。
语法
void gl.depthFunc(func);
参数
返回值
无。
示例
深度测试默认是禁用的。要启用或禁用深度测试,请使用带有参数 gl.DEPTH_TEST
的 enable()
和 disable()
方法。
js
gl.enable(gl.DEPTH_TEST);
gl.depthFunc(gl.NEVER);
要检查当前深度函数,请查询 DEPTH_FUNC
常量。
js
gl.getParameter(gl.DEPTH_FUNC) === gl.NEVER;
// true
规范
Specification |
---|
WebGL Specification> # 5.14.3> |
浏览器兼容性
Loading…