getUniformLocation method

WebGLUniformLocation? getUniformLocation(
  1. WebGLProgram program,
  2. String name
)

Part of the WebGL API, the WebGLRenderingContext method getUniformLocation() returns the location of a specific uniform variable which is part of a given WebGLProgram.

The uniform variable is returned as a WebGLUniformLocation object, which is an opaque identifier used to specify where in the GPU's memory that uniform variable is located.

Once you have the uniform's location, you can access the uniform itself using one of the other uniform access methods, passing in the uniform location as one of the inputs:

The uniform itself is declared in the shader program using GLSL.

Implementation

external WebGLUniformLocation? getUniformLocation(
  WebGLProgram program,
  String name,
);