Skip to content

Lower level

createVertexArray() ​

ts
function createVertexArray(
   gl, 
   program, 
   attributes, 
   indexOffset?
): VertexArrayBindings;

Defined in: createVertexArray.js:38

Creates the vertex array(s) for a set of attribute definitions and binds each attribute's location on program, which must not be linked yet.

With transform feedback attributes it builds two vertex arrays and two transform feedback objects that ping-pong: vertex array 0 reads the buffers that transform feedback 0 writes, and the same for 1. Only the transform feedback buffers are doubled; every other attribute shares one buffer.

Parameters ​

ParameterTypeDefault valueDescription
glWebGL2RenderingContextundefinedThe WebGL2 context.
programWebGLProgramundefinedAn unlinked program, from createProgram.
attributesRecord<string, Attribute>undefined-
indexOffset?number0Added to every default attribute location.

Returns ​

VertexArrayBindings