web api instance method
WebGL2RenderingContext: uniform[1234][uif][v]() method
Available in workers
The WebGL2RenderingContext.uniform[1234][uif][v]()
methods of the WebGL API specify values of
uniform variables.
The names of these methods are formed by:
- The number of components in the uniform variable (1, 2, 3, or 4).
- The type of the uniform variable (
ifor integer,ffor float,uifor unsigned integer). - The presence of a vector (
v) suffix for vector types.
They can be matched by the regex uniform[1234](u?i|f)v?.
Most of these signatures are inherited from the WebGL 1 API. WebGL 2 adds the unsigned integer versions, and the additional srcOffset and srcLength parameters to the vector methods.
Syntax
uniform1ui(location, v0)
uniform2ui(location, v0, v1)
uniform3ui(location, v0, v1, v2)
uniform4ui(location, v0, v1, v2, v3)
uniform1fv(location, data)
uniform1fv(location, data, srcOffset)
uniform1fv(location, data, srcOffset, srcLength)
uniform2fv(location, data)
uniform2fv(location, data, srcOffset)
uniform2fv(location, data, srcOffset, srcLength)
uniform3fv(location, data)
uniform3fv(location, data, srcOffset)
uniform3fv(location, data, srcOffset, srcLength)
uniform4fv(location, data)
uniform4fv(location, data, srcOffset)
uniform4fv(location, data, srcOffset, srcLength)
uniform1iv(location, data)
uniform1iv(location, data, srcOffset)
uniform1iv(location, data, srcOffset, srcLength)
uniform2iv(location, data)
uniform2iv(location, data, srcOffset)
uniform2iv(location, data, srcOffset, srcLength)
uniform3iv(location, data)
uniform3iv(location, data, srcOffset)
uniform3iv(location, data, srcOffset, srcLength)
uniform4iv(location, data)
uniform4iv(location, data, srcOffset)
uniform4iv(location, data, srcOffset, srcLength)
uniform1uiv(location, data)
uniform1uiv(location, data, srcOffset)
uniform1uiv(location, data, srcOffset, srcLength)
uniform2uiv(location, data)
uniform2uiv(location, data, srcOffset)
uniform2uiv(location, data, srcOffset, srcLength)
uniform3uiv(location, data)
uniform3uiv(location, data, srcOffset)
uniform3uiv(location, data, srcOffset, srcLength)
uniform4uiv(location, data)
uniform4uiv(location, data, srcOffset)
uniform4uiv(location, data, srcOffset, srcLength)
Parameters
location- : A
WebGLUniformLocationobject containing the location of the uniform attribute to modify.
- : A
data,v0,v1,v2,v3- : A new value to be used for the uniform variable. Possible types:
- A
Numberfor unsigned integer values (methods withui), for integer values (methods withi), or for floats (methods withf). - A
Uint32Array(or anArrayof unsigned integer numbers) for unsigned integer vector methods (methods withuiv). - An
Int32Array(or anArrayof integer numbers) for integer vector methods (methods withiv). - A
Float32Array(or anArrayof numbers) for floating point vector methods (methods withfv).
- A
- : A new value to be used for the uniform variable. Possible types:
srcOffsetOptional- : A non-negative integer specifying the index of the first element in the
dataarray to be used. Defaults to0.
- : A non-negative integer specifying the index of the first element in the
srcLengthOptional- : A non-negative integer specifying the number of elements in the
dataarray to be used. Defaults to0, which gets treated asdata.length - srcOffset.srcOffset + srcLengthmust be less than or equal todata.length.
- : A non-negative integer specifying the number of elements in the
Return value
None (undefined).
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.