Class: VertexBuffer

VertexBuffer()

new VertexBuffer()

Storage for vertex data.
Properties:
Name Type Description
gl WebGLRenderingContext The WebGL context.
buffer WebGLBuffer Allocated buffer storage.
type GLenum The type of data stored in the buffer.
itemSize number Number of array elements per vertex.
numItems number Number of vertices represented.
usage GLenum The usage pattern of the buffer.
indexArray boolean Whether this is an index array.
binding GLenum GL binding point (ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER).
appState Object Tracked GL state.
Source:

Methods

data(data, offsetopt) → {VertexBuffer}

Update data in this buffer. NOTE: the data must fit the originally-allocated buffer!
Parameters:
Name Type Attributes Default Description
data ArrayBufferView Data to store in the buffer.
offset number <optional>
0 Byte offset into the buffer at which to start writing.
Source:
Returns:
The VertexBuffer object.
Type
VertexBuffer

delete() → {VertexBuffer}

Delete this array buffer.
Source:
Returns:
The VertexBuffer object.
Type
VertexBuffer

restore(data) → {VertexBuffer}

Restore vertex buffer after context loss.
Parameters:
Name Type Description
data ArrayBufferView | number Buffer data itself or the total number of elements to be allocated.
Source:
Returns:
The VertexBuffer object.
Type
VertexBuffer