getUniformLocation method
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:
- WebGLRenderingContext.getUniform
- : Returns the value of the uniform at the given location.
WebGLRenderingContext.uniform[1234][fi][v]()
- : Sets the uniform's value to the specified value, which may be a single floating
point or integer number, or a 2-4 component vector specified either as a
list of
values or as a
Float32Array
orInt32Array
.
- : Sets the uniform's value to the specified value, which may be a single floating
point or integer number, or a 2-4 component vector specified either as a
list of
values or as a
WebGLRenderingContext.uniformMatrix[234][fv]()
- : Sets the uniform's value to the specified matrix, possibly with transposition. The
value is represented as a sequence of
GLfloat
values or as aFloat32Array
.
- : Sets the uniform's value to the specified matrix, possibly with transposition. The
value is represented as a sequence of
The uniform itself is declared in the shader program using GLSL.
Implementation
external WebGLUniformLocation? getUniformLocation(
WebGLProgram program,
String name,
);