MDN self-hosted library · e01.org

WebGLRenderingContext: getAttribLocation() method

WebGL

WebGL

The WebGLRenderingContext.getAttribLocation() method of the WebGL API returns the location of an attribute variable in a given WebGLProgram.

Syntax

getAttribLocation(program, name)

Parameters

  • program
  • : A WebGLProgram containing the attribute variable.
  • name
  • : A string specifying the name of the attribute variable whose location to get.

Return value

A GLint number indicating the location of the variable name if found. Returns -1 otherwise.

Examples

gl.getAttribLocation(program, "vColor");

Specifications

Browser compatibility

See also

  • WebGLRenderingContext.getUniformLocation()