WebGL2RenderingContext.uniform[1234][uif][v]()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.
WebGL API的**WebGL2RenderingContext.uniform[1234][uif][v]()
** 方法提供了 uniform(es)变量的详细值
备注: ui
意为无符号整数, i
意为整数,f
意为浮点数, 并且 v
意为矢量。
并不是所有的组合都是有效的:u
不能是 f
的组合。详见下方语法表格。用 正则表达式概括语法:uniform[1234](u?i|f)v?
语法
js
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)
参数
- location
-
一个
WebGLUniformLocation
对象包含了本地 uniform 属性的修改。 value, v0, v1, v2, v3
-
一个新的值被应用到 uniform 变量当中。合理情况:
Number
如果是无符号整数值 (则用ui
方法),如果是整数值 (则用i
方法), 如果是浮点数 (则用f
方法).Uint32Array
用于无符号整数向量(矢量)方法 (则用uiv
方法).
返回值
没有返回值
规范
Specification |
---|
WebGL 2.0 Specification # 3.7.8 |
浏览器兼容性
BCD tables only load in the browser