--- title: WebGLRenderingContext.bindAttribLocation() slug: Web/API/WebGLRenderingContext/bindAttribLocation tags: - WebGL - WebGLRenderingContext translation_of: Web/API/WebGLRenderingContext/bindAttribLocation ---
{{APIRef("WebGL")}}
WebGL API的WebGLRenderingContext.bindAttribLocation()方法将通用顶点索引绑定到属性变量。
void gl.bindAttribLocation(program, index, name);
program
None.
gl.bindAttribLocation(program, colorLocation, 'vColor');
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.9", "bindAttribLocation")}} | {{Spec2('WebGL')}} | Initial definition. |
{{SpecName('OpenGL ES 2.0', "glBindAttribLocation.xml", "glBindAttribLocation")}} | {{Spec2('OpenGL ES 2.0')}} | Man page of the (similar) OpenGL API. |
{{Compat("api/WebGLRenderingContext", "WebGLRenderingContext.bindAttribLocation")}}