Constructor
new IndexBuffer(graphicsDevice, format, numIndices, usageopt, initialDataopt)
Creates a new index buffer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
graphicsDevice |
pc.GraphicsDevice | The graphics device used to manage this index buffer. | |
format |
Number | The type of each index to be stored in the index buffer (see pc.INDEXFORMAT_*). | |
numIndices |
Number | The number of indices to be stored in the index buffer. | |
usage |
Number |
<optional> |
The usage type of the vertex buffer (see pc.BUFFER_*). |
initialData |
ArrayBuffer |
<optional> |
Initial data. |
- Source:
Example
// Create an index buffer holding 3 16-bit indices
// The buffer is marked as static, hinting that the buffer will never be modified
var indexBuffer = new pc.IndexBuffer(graphicsDevice, pc.INDEXFORMAT_UINT16, 3, pc.BUFFER_STATIC);
Methods
destroy()
Frees resources associated with this index buffer.
- Source:
getFormat() → {Number}
Returns the data format of the specified index buffer.
- Source:
Returns:
The data format of the specified index buffer (see pc.INDEXFORMAT_*).
- Type
- Number
getNumIndices() → {Number}
Returns the number of indices stored in the specified index buffer.
- Source:
Returns:
The number of indices stored in the specified index buffer.
- Type
- Number
lock() → {ArrayBuffer}
Gives access to the block of memory that stores the buffer's indices.
- Source:
Returns:
A contiguous block of memory where index data can be written to.
- Type
- ArrayBuffer
unlock()
Signals that the block of memory returned by a call to the lock function is
ready to be given to the graphics hardware. Only unlocked index buffers can be set on the
currently active device.
- Source: