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

浏览器兼容性

另见