WebGL2RenderingContext: getUniformBlockIndex() 方法
注意:此功能在 Web Workers 中可用。
WebGL2RenderingContext.getUniformBlockIndex() 方法是 WebGL 2 API 的一部分,用於檢索 WebGLProgram 中 uniform 塊的索引。
語法
js
getUniformBlockIndex(program, uniformBlockName)
引數
program-
包含 uniform 塊的
WebGLProgram。 uniformName-
一個字串,指定要檢索其索引的 uniform 塊的名稱。
返回值
一個 GLuint,表示 uniform 塊的索引。
示例
js
// Assuming a shader with the following declaration:
// uniform UBOData {
// mat4 foo;
// } instanceName;
// use the block name, not the instance name:
const blockIndex = gl.getUniformBlockIndex(program, "UBOData");
規範
| 規範 |
|---|
| WebGL 2.0 規範 # 3.7.16 |
瀏覽器相容性
載入中…