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

瀏覽器相容性

另見