Class: VertexArray

VertexArray()

new VertexArray()

Organizes vertex buffer and attribute state.
Properties:
Name Type Description
gl WebGLRenderingContext The WebGL context.
vertexArray WebGLVertexArrayObject Vertex array object.
numElements number Number of elements in the vertex array.
indexed boolean Whether this vertex array is set up for indexed drawing.
indexType GLenum Data type of the indices.
numInstances number Number of instances to draw with this vertex array.
appState Object Tracked GL state.
Source:

Methods

delete() → {VertexArray}

Delete this vertex array.
Source:
Returns:
The VertexArray object.
Type
VertexArray

indexBuffer(vertexBuffer) → {VertexArray}

Bind an index buffer to this vertex array.
Parameters:
Name Type Description
vertexBuffer VertexBuffer The VertexBuffer to bind.
Source:
Returns:
The VertexArray object.
Type
VertexArray

instanceAttributeBuffer(attributeIndex, vertexBuffer, optionsopt) → {VertexArray}

Bind an per-instance attribute buffer to this vertex array.
Parameters:
Name Type Attributes Description
attributeIndex number The attribute location to bind to.
vertexBuffer VertexBuffer The VertexBuffer to bind.
options Object <optional>
Attribute pointer options. These will override those provided in the VertexBuffer.
Properties
Name Type Attributes Description
type GLenum <optional>
Type of data stored in the buffer.
size GLenum <optional>
Number of components per vertex.
stride GLenum <optional>
Number of bytes between the start of data for each vertex.
offset GLenum <optional>
Number of bytes before the start of data for the first vertex.
normalized GLenum <optional>
Data is integer data that should be normalized to a float.
integer GLenum <optional>
Pass data as integers.
Source:
Returns:
The VertexArray object.
Type
VertexArray

restore() → {VertexArray}

Restore vertex array after context loss.
Source:
Returns:
The VertexArray object.
Type
VertexArray

vertexAttributeBuffer(attributeIndex, vertexBuffer, optionsopt) → {VertexArray}

Bind an per-vertex attribute buffer to this vertex array.
Parameters:
Name Type Attributes Description
attributeIndex number The attribute location to bind to.
vertexBuffer VertexBuffer The VertexBuffer to bind.
options Object <optional>
Attribute pointer options. These will override those provided in the VertexBuffer.
Properties
Name Type Attributes Description
type GLenum <optional>
Type of data stored in the buffer.
size GLenum <optional>
Number of components per vertex.
stride GLenum <optional>
Number of bytes between the start of data for each vertex.
offset GLenum <optional>
Number of bytes before the start of data for the first vertex.
normalized GLenum <optional>
Data is integer data that should be normalized to a float.
integer GLenum <optional>
Pass data as integers.
Source:
Returns:
The VertexArray object.
Type
VertexArray