Class: VertexBuffer

pc.VertexBuffer

A vertex buffer is the mechanism via which the application specifies vertex data to the graphics hardware.

Constructor

new VertexBuffer(graphicsDevice, format, numVertices, usageopt, initialDataopt)

Creates a new vertex buffer object.
Parameters:
Name Type Attributes Description
graphicsDevice pc.GraphicsDevice The graphics device used to manage this vertex buffer.
format pc.VertexFormat The vertex format of this vertex buffer.
numVertices Number The number of vertices that this vertex buffer will hold.
usage Number <optional>
The usage type of the vertex buffer (see pc.BUFFER_*).
initialData ArrayBuffer <optional>
Initial data.
Source:

Methods

destroy()

Frees resources associated with this vertex buffer.
Source:

getFormat() → {pc.VertexFormat}

Returns the data format of the specified vertex buffer.
Source:
Returns:
The data format of the specified vertex buffer.
Type
pc.VertexFormat

getNumVertices() → {Number}

Returns the number of vertices stored in the specified vertex buffer.
Source:
Returns:
The number of vertices stored in the vertex buffer.
Type
Number

getUsage() → {Number}

Returns the usage type of the specified vertex buffer. This indicates whether the buffer can be modified once and used many times (pc.BUFFER_STATIC), modified repeatedly and used many times (pc.BUFFER_DYNAMIC) or modified once and used at most a few times (pc.BUFFER_STREAM).
Source:
Returns:
The usage type of the vertex buffer (see pc.BUFFER_*).
Type
Number

lock() → {ArrayBuffer}

Returns a mapped memory block representing the content of the vertex buffer.
Source:
Returns:
An array containing the byte data stored in the vertex buffer.
Type
ArrayBuffer

unlock()

Notifies the graphics engine that the client side copy of the vertex buffer's memory can be returned to the control of the graphics driver.
Source: