--- title: WebGL2RenderingContext.createVertexArray() slug: Web/API/WebGL2RenderingContext/createVertexArray tags: - Method - WebGL2 translation_of: Web/API/WebGL2RenderingContext/createVertexArray ---
WebGL 2 API 中的 WebGL2RenderingContext.createVertexArray()
方法创建并初始化(creates and initializes)一个 {{domxref("WebGLVertexArrayObject")}} 的对象(object) ,它代表一个指向顶点数组数据的顶点数组对象(vertex array object (VAO) ),并为不同的顶点数据集提供名称。
WebGLVertexArrayObject gl.createVertexArray();
没有参数
一个{{domxref("WebGLVertexArrayObject")}}对象 代表 一个顶点数组对象 (VAO) ,该对象指向顶点数据。
var vao = gl.createVertexArray(); gl.bindVertexArray(vao); // ... // calls to bindBuffer or vertexAttribPointer // which will be "recorded" in the VAO // ...
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL2', "#3.7.17", "createVertexArray")}} | {{Spec2('WebGL2')}} | Initial definition. |
{{SpecName('OpenGL ES 3.0', "glGenVertexArrays.xhtml", "glGenVertexArrays")}} | {{Spec2('OpenGL ES 3.0')}} | Man page of the (similar) OpenGL API. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.WebGL2RenderingContext.createVertexArray")}}