WebGL2RenderingContext: Methode getUniformBlockIndex()
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.
Hinweis: Diese Funktion ist in Web Workers verfügbar.
Die WebGL2RenderingContext.getUniformBlockIndex()-Methode
der WebGL 2 API ruft den Index eines Uniform-Blocks innerhalb eines WebGLProgram ab.
Syntax
js
getUniformBlockIndex(program, uniformBlockName)
Parameter
program-
Ein
WebGLProgram, das den Uniform-Block enthält. uniformName-
Ein String, der den Namen des Uniform-Blocks angibt, dessen Index abgerufen werden soll.
Rückgabewert
Ein GLuint, der den Index des Uniform-Blocks angibt.
Beispiele
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");
Spezifikationen
| Specification |
|---|
| WebGL 2.0 Specification> # 3.7.16> |
Browser-Kompatibilität
Loading…