The WebGLRenderingContext.uniformMatrix[234]fv() methods of the WebGL API specify matrix values for uniform variables.
Syntax
void gl.uniformMatrix2fv(location, transpose, value); void gl.uniformMatrix3fv(location, transpose, value); void gl.uniformMatrix4fv(location, transpose, value);
Parameters
- location
- A
WebGLUniformLocationobject containing the location of the uniform attribute to modify. - transpose
- A
GLbooleanspecifying whether to transpose the matrix. Must befalse. value- A
Float32Arrayof float values.
Return value
None.
Examples
gl.uniformMatrix2fv(loc, false, [0,2,1, 2,2]);
Specifications
| Specification | Status | Comment |
|---|---|---|
| WebGL 1.0 The definition of 'uniformMatrix' in that specification. |
Recommendation | Initial definition. |
| OpenGL ES 2.0 The definition of 'glUniform' in that specification. |
Standard | Man page of the OpenGL API. |
Browser compatibility
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 9 | 12 | 4.0 (2.0) | 11 | 12 | 5.1 |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
| Basic support | ? | 25 | 4.0 (2.0) | 1.0 | ? | 12 | 8.0 |