WebGL2RenderingContext:bindVertexArray() 方法

Baseline 已廣泛支援

此功能已成熟,並可在多種裝置和瀏覽器版本上執行。自 2021 年 9 月起,所有瀏覽器均已支援此功能。

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

WebGL2RenderingContext.bindVertexArray() 方法是 WebGL 2 API 的一部分,用於將傳入的 WebGLVertexArrayObject 物件繫結到緩衝區。

語法

js
bindVertexArray(vertexArray)

引數

vertexArray

要繫結的 WebGLVertexArrayObject (VAO) 物件。

返回值

無(undefined)。

示例

js
const vao = gl.createVertexArray();
gl.bindVertexArray(vao);

// …

// calls to bindBuffer or vertexAttribPointer
// which will be "recorded" in the VAO

// …

規範

規範
WebGL 2.0 規範
# 3.7.17

瀏覽器相容性

另見