Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1.06 KB

File metadata and controls

50 lines (34 loc) · 1.06 KB
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")}}.

Syntax

getAttribLocation(program, name)

Parameters

  • program
    • : A {{domxref("WebGLProgram")}} containing the attribute variable.
  • name
    • : A string specifying the name of the attribute variable whose location to get.

Return value

A {{domxref("WebGL_API/Types", "GLint")}} number indicating the location of the variable name if found. Returns -1 otherwise.

Examples

gl.getAttribLocation(program, "vColor");

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("WebGLRenderingContext.getUniformLocation()")}}