WebGL2RenderingContext.createVertexArray()

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.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

WebGL 2 API 中的 **WebGL2RenderingContext.createVertexArray()**方法创建并初始化(creates and initializes)一个 WebGLVertexArrayObject 的对象 (object) ,它代表一个指向顶点数组数据的顶点数组对象(vertex array object (VAO) ),并为不同的顶点数据集提供名称。

语法

js
createVertexArray()

参数

没有参数

返回值

一个WebGLVertexArrayObject对象 代表 一个顶点数组对象 (VAO) ,该对象指向顶点数据。

示例

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

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

规范

Specification
WebGL 2.0 Specification
# 3.7.17

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
createVertexArray

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见