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

WebGLRenderingContext.getAttribLocation() 方法返回了给定{{domxref("WebGLProgram")}}对象中某属性的下标指向位置。

+ +

语法

+ +
GLint gl.getAttribLocation(program, name);
+
+ +

参数

+ +
+
program
+
一个包含了属性参数的{{domxref("WebGLProgram")}} 对象。
+
name
+
需要获取下标指向位置的 {{domxref("DOMString")}} 属性参数名
+
+ +

返回值

+ +

表明属性位置的下标 {{domxref("GLint")}} 数字,如果找不到该属性则返回-1。

+ +

示例

+ +
gl.getAttribLocation(program, 'vColor');
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('WebGL', "#5.14.10", "getAttribLocation")}}{{Spec2('WebGL')}}原始定义.
{{SpecName('OpenGL ES 2.0', "glGetAttribLocation.xml", "glGetAttribLocation")}}{{Spec2('OpenGL ES 2.0')}}OpenGL API的主页.
+ +

浏览器兼容性

+ + + +

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

+ +

相关资料

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