From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../webglrenderingcontext/cleardepth/index.html | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 files/zh-cn/web/api/webglrenderingcontext/cleardepth/index.html (limited to 'files/zh-cn/web/api/webglrenderingcontext/cleardepth') diff --git a/files/zh-cn/web/api/webglrenderingcontext/cleardepth/index.html b/files/zh-cn/web/api/webglrenderingcontext/cleardepth/index.html new file mode 100644 index 0000000000..a663975cc2 --- /dev/null +++ b/files/zh-cn/web/api/webglrenderingcontext/cleardepth/index.html @@ -0,0 +1,75 @@ +--- +title: WebGLRenderingContext.clearDepth() +slug: Web/API/WebGLRenderingContext/clearDepth +tags: + - WebGL + - 深度清除值 +translation_of: Web/API/WebGLRenderingContext/clearDepth +--- +
{{APIRef("WebGL")}}
+ +

WebGL APIWebGLRenderingContext.clearDepth() 方法用于设置深度缓冲区的深度清除值。

+ +

这个深度清除值的设定,是为了调用{{domxref("WebGLRenderingContext.clear", "clear()")}} 的时候使用,这个值的范围是0到1。

+ +

语法

+ +
void gl.clearDepth(depth);
+
+ +

参数

+ +
+
depth
+
类型:{{domxref("GLclampf")}}。 深度值的设定,是当清除深度缓冲区的时候使用。默认值为1。
+
+ +

返回值

+ +

None.

+ +

样例

+ +
gl.clearDepth(0.5);
+
+ +

若要获取当前深度清除值,查询DEPTH_CLEAR_VALUE 常量。

+ +
gl.getParameter(gl.DEPTH_CLEAR_VALUE);
+// 0.5
+ +

规范

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('WebGL', "#5.14.3", "clearDepth")}}{{Spec2('WebGL')}}Initial definition.
{{SpecName('OpenGL ES 2.0', "glClearDepthf.xml", "glClearDepthf")}}{{Spec2('OpenGL ES 2.0')}}Man page of the OpenGL API.
+ +

浏览器兼容性

+ + + +

{{Compat("api.WebGLRenderingContext.clearDepth")}}

+ +

另见

+ + -- cgit v1.2.3-54-g00ecf