title | short-title | slug | page-type | browser-compat |
---|---|---|---|---|
WebGLRenderingContext: getAttribLocation() method |
getAttribLocation() |
Web/API/WebGLRenderingContext/getAttribLocation |
web-api-instance-method |
api.WebGLRenderingContext.getAttribLocation |
{{APIRef("WebGL")}}
The WebGLRenderingContext.getAttribLocation()
method of
the WebGL API returns the location of an
attribute variable in a given {{domxref("WebGLProgram")}}.
getAttribLocation(program, name)
program
- : A {{domxref("WebGLProgram")}} containing the attribute variable.
name
- : A string specifying the name of the attribute variable whose location to get.
A {{domxref("WebGL_API/Types", "GLint")}} number indicating the location of the variable name if found. Returns -1 otherwise.
gl.getAttribLocation(program, "vColor");
{{Specifications}}
{{Compat}}
- {{domxref("WebGLRenderingContext.getUniformLocation()")}}