files/en-us/web/api/webgl2renderingcontext/getactiveuniforms/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The WebGL2RenderingContext.getActiveUniforms() method of
the WebGL 2 API retrieves information about
active uniforms within a {{domxref("WebGLProgram")}}.
getActiveUniforms(program, uniformIndices, pname)
program
uniformIndices
pname
gl.UNIFORM_TYPE
gl.UNIFORM_SIZE
gl.UNIFORM_BLOCK_INDEX
gl.UNIFORM_OFFSET
gl.UNIFORM_ARRAY_STRIDE
gl.UNIFORM_MATRIX_STRIDE
gl.UNIFORM_IS_ROW_MAJOR
Depends on which information is requested using the pname parameter.
const uniformIndices = gl.getUniformIndices(program, [
"UBORed",
"UBOGreen",
"UBOBlue",
]);
const uniformOffsets = gl.getActiveUniforms(
program,
uniformIndices,
gl.UNIFORM_OFFSET,
);
{{Specifications}}
{{Compat}}