Back to Content

WebGL2RenderingContext: bindVertexArray() method

files/en-us/web/api/webgl2renderingcontext/bindvertexarray/index.md

latest755 B
Original Source

{{APIRef("WebGL")}}{{AvailableInWorkers}}

The WebGL2RenderingContext.bindVertexArray() method of the WebGL 2 API binds a passed {{domxref("WebGLVertexArrayObject")}} object to the buffer.

Syntax

js-nolint
bindVertexArray(vertexArray)

Parameters

  • vertexArray
    • : A {{domxref("WebGLVertexArrayObject")}} (VAO) object to bind.

Return value

None ({{jsxref("undefined")}}).

Examples

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

// …

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

// …

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("WebGLVertexArrayObject")}}