API Reference

Class List

pc.VertexBuffer

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

Summary

Methods

destroyFrees resources associated with this vertex buffer.
getFormatReturns the data format of the specified vertex buffer.
getNumVerticesReturns the number of vertices stored in the specified vertex buffer.
getUsageReturns the usage type of the specified vertex buffer.
lockReturns a mapped memory block representing the content of the vertex buffer.
unlockNotifies the graphics engine that the client side copy of the vertex buffer's memory can be returned to the control of the graphics driver.

Details

Constructor

VertexBuffer(graphicsDevice, format, numVertices, [usage])

Creates a new vertex buffer object.

Parameters

graphicsDevicepc.GraphicsDeviceThe graphics device used to manage this vertex buffer.
formatpc.VertexFormatThe vertex format of this vertex buffer.
numVerticesNumberThe number of vertices that this vertex buffer will hold.
usageNumberThe usage type of the vertex buffer (see pc.BUFFER_*).

Methods

destroy()

Frees resources associated with this vertex buffer.

getFormat()

Returns the data format of the specified vertex buffer.

Returns

pc.VertexFormat The data format of the specified vertex buffer.

getNumVertices()

Returns the number of vertices stored in the specified vertex buffer.

Returns

Number The number of vertices stored in the vertex buffer.

getUsage()

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).

Returns

Number The usage type of the vertex buffer (see pc.BUFFER_*).

lock()

Returns a mapped memory block representing the content of the vertex buffer.

Returns

ArrayBuffer An array containing the byte data stored in the vertex buffer.

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.