WebGL2RenderingContext: uniformMatrix[234]x[234]fv() 方法

基线 广泛可用

此功能已非常成熟,可以在许多设备和浏览器版本上运行。它自 2021 年 9 月.

报告反馈

WebGL2RenderingContext.uniformMatrix[234]x[234]fv()WebGL 2 API 中用于为统一变量指定矩阵值的方法。

语法

注意:此方法没有 2x23x34x4 版本。它们分别缩写为 234。请参阅下面的语法。
uniformMatrix2fv(location, transpose, data)
uniformMatrix2fv(location, transpose, data, srcOffset)
uniformMatrix2fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix3x2fv(location, transpose, data)
uniformMatrix3x2fv(location, transpose, data, srcOffset)
uniformMatrix3x2fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix4x2fv(location, transpose, data)
uniformMatrix4x2fv(location, transpose, data, srcOffset)
uniformMatrix4x2fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix2x3fv(location, transpose, data)
uniformMatrix2x3fv(location, transpose, data, srcOffset)
uniformMatrix2x3fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix3fv(location, transpose, data)
uniformMatrix3fv(location, transpose, data, srcOffset)
uniformMatrix3fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix4x3fv(location, transpose, data)
uniformMatrix4x3fv(location, transpose, data, srcOffset)
uniformMatrix4x3fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix2x4fv(location, transpose, data)
uniformMatrix2x4fv(location, transpose, data, srcOffset)
uniformMatrix2x4fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix3x4fv(location, transpose, data)
uniformMatrix3x4fv(location, transpose, data, srcOffset)
uniformMatrix3x4fv(location, transpose, data, srcOffset, srcLength)

uniformMatrix4fv(location, transpose, data)
uniformMatrix4fv(location, transpose, data, srcOffset)
uniformMatrix4fv(location, transpose, data, srcOffset, srcLength)

js

参数

location

包含要修改的统一属性位置的 WebGLUniformLocation 对象。

transpose

一个 GLboolean,用于指定是否要转置矩阵。

data

一个包含浮点值的 Float32Array

返回值

示例

注意:此方法没有 2x23x34x4 版本。它们分别缩写为 234。请参阅下面的语法。
gl.uniformMatrix2x3fv(loc, false, [1, 2, 3, 4, 5, 6]);

规范

无(undefined)。
规范
# 5.14.10

浏览器兼容性

WebGL 规范

另请参阅