WebGLRenderingContext.uniformMatrix[234]fv()

This translation is incomplete. Please help translate this article from English

WebGL API 的WebGLRenderingContext.uniformMatrix[234]fv() 方法为 uniform variables 指定了矩阵值 .

该方法的3个版本 (uniformMatrix2fv(), uniformMatrix3fv(), 和unifomMatrix4fv()) 分别以2分量、3分量和4分量向量作为输入值。

语法

WebGLRenderingContext.uniformMatrix2fv(location, transpose, value);
WebGLRenderingContext.uniformMatrix3fv(location, transpose, value);
WebGLRenderingContext.uniformMatrix4fv(location, transpose, value); 

参数

location
WebGLUniformLocation 对象包含了要修改的 uniform attribute位置. 位置使用 getUniformLocation()获得.
transpose
GLboolean 指定是否转置矩阵。必须为 false.
value

 Float32Array 型或者是 GLfloat 序列值.

返回值

undefined

示例

gl.uniformMatrix2fv(loc, false, [2,1, 2,2]);

说明

Specification Status Comment
WebGL 1.0
uniformMatrix
Recommendation Initial definition.
OpenGL ES 2.0
glUniform
Standard Man page of the OpenGL API.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
uniformMatrix2fvChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Firefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8Samsung Internet Android Full support 1.5
WebGL2Chrome Full support 56Edge No support NoFirefox Full support 51IE No support NoOpera Full support 43Safari No support NoWebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 51Opera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0

Legend

Full support  
Full support
No support  
No support

另见