WebGL2RenderingContext:getUniformIndices() 方法

Baseline 已广泛支持

此功能已成熟,并可在多种设备和浏览器版本上运行。自 2021 年 9 月起,所有浏览器均已支持此功能。

注意:此功能在 Web Workers 中可用。

WebGL2RenderingContext.getUniformIndices() 方法是 WebGL 2 API 的一部分,用于检索 WebGLProgram 中一组 uniform 的索引。

语法

js
getUniformIndices(program, uniformNames)

参数

program

包含要查询其索引的 uniform 的 WebGLProgram

uniformNames

一个字符串 Array,指定要查询的 uniform 的名称。

返回值

一个包含 uniform 索引的 Array,其类型为 GLuint

示例

js
const uniformIndices = gl.getUniformIndices(program, [
  "UBORed",
  "UBOGreen",
  "UBOBlue",
]);

规范

规范
WebGL 2.0 规范
# 3.7.16

浏览器兼容性

另见