WebGLRenderingContext.depthMask()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

WebGL APIWebGLRenderingContext.depthMask() 方法设置是否启用写入深度缓冲。

语法

void gl.depthMask(flag);

参数

flag

一个 GLboolean ,用于设置是否启用写入深度缓冲。默认值:true,表示启用写入。

返回值

无。

例子

js
gl.depthMask(false);

要获得当前的深度遮罩值,传入 DEPTH_WRITEMASK 常量,返回 Boolean.

js
gl.getParameter(gl.DEPTH_WRITEMASK);
// false

规范

Specification
WebGL Specification
# 5.14.3

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
depthMask

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

相关内容