VertexBuffer

VertexBuffer

A vertex buffer object.

Constructor

new VertexBuffer(arg, attributePointers, options)

Instantiates an VertexBuffer object.
Source:
Parameters:
Name Type Description
arg WebGLBuffer | VertexPackage | ArrayBuffer | Array | Number The buffer or length of the buffer.
attributePointers Object The array pointer map, or in the case of a vertex package arg, the options.
options Object The rendering options.
Name Type Description
mode string The draw mode / primitive type.
indexOffset string The index offset into the drawn buffer.
count string The number of indices to draw.

Methods

bind() → {VertexBuffer}

Binds the vertex buffer object.
Source:
Returns:
Type:
VertexBuffer
- Returns the vertex buffer object for chaining.

bufferData(arg) → {VertexBuffer}

Upload vertex data to the GPU.
Source:
Parameters:
Name Type Description
arg Array | ArrayBuffer | ArrayBufferView | number The array of data to buffer, or size of the buffer in bytes.
Returns:
Type:
VertexBuffer
The vertex buffer object, for chaining.

bufferSubData(array, byteOffset) → {VertexBuffer}

Upload partial vertex data to the GPU.
Source:
Parameters:
Name Type Description
array Array | ArrayBuffer The array of data to buffer.
byteOffset number The byte offset at which to buffer.
Returns:
Type:
VertexBuffer
The vertex buffer object, for chaining.

draw(options) → {VertexBuffer}

Execute the draw command for the bound buffer.
Source:
Parameters:
Name Type Description
options Object The options to pass to 'drawArrays'. Optional.
Name Type Description
mode string The draw mode / primitive type.
indexOffset string The index offset into the drawn buffer.
count string The number of indices to draw.
Returns:
Type:
VertexBuffer
The vertex buffer object, for chaining.

unbind() → {VertexBuffer}

Unbinds the vertex buffer object.
Source:
Returns:
Type:
VertexBuffer
The vertex buffer object, for chaining.