--- title: 'WebGLRenderingContext.uniformMatrix[234]fv()' slug: Web/API/WebGLRenderingContext/uniformMatrix tags: - WebGL - WebGLAPI - WebGLRenderingContext - uniformMatrix2fv - uniformMatrix3fv - uniformMatrix4fv - 矩阵 translation_of: Web/API/WebGLRenderingContext/uniformMatrix ---
WebGL API 的WebGLRenderingContext.uniformMatrix[234]fv()
方法为 uniform variables 指定了矩阵值 .
该方法的3个版本 (uniformMatrix2fv()
, uniformMatrix3fv()
, 和unifomMatrix4fv()
) ,分别以二阶,三阶,和四阶方阵作为输入值,它们应是分别具有4,9,16个浮点数的数组.
WebGLRenderingContext.uniformMatrix2fv(location, transpose, value); WebGLRenderingContext.uniformMatrix3fv(location, transpose, value); WebGLRenderingContext.uniformMatrix4fv(location, transpose, value);
location
transpose
false
.value
{{jsxref("Float32Array")}} 型或者是 GLfloat
序列值.假定值以列主要顺序提供.
undefined
gl.uniformMatrix2fv(loc, false, [2,1, 2,2]);
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.10", "uniformMatrix")}} | {{Spec2('WebGL')}} | Initial definition. |
{{SpecName('OpenGL ES 2.0', "glUniform.xml", "glUniform")}} | {{Spec2('OpenGL ES 2.0')}} | Man page of the OpenGL API. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.WebGLRenderingContext.uniformMatrix2fv")}}