C4 Engine
C4 Engine API Documentation

Renderable::SetVertexBuffer

Defined in:  C4Renderable.h
Assigns a vertex buffer to a renderable.
Prototype

void SetVertexBuffer(uint32 index, VertexBuffer *buffer, uint32 stride = 0);

Parameters
index The index of the vertex buffer. See below for possible values.
buffer A pointer to the vertex buffer to assign.
stride The stride between two consecutive vertices, in bytes.
Description
The SetVertexBuffer function assigns the vertex buffer specified by the buffer parameter to the vertex buffer slot specified by the index parameter. The index parameter can be one of the following constants.
kVertexBufferAttributeArray The primary vertex buffer containing vertex attributes.
kVertexBufferAttributeArray0 An alternate name for the primary vertex buffer containing vertex attributes.
kVertexBufferAttributeArray1 The secondary vertex buffer containing vertex attributes.
kVertexBufferIndexArray The vertex buffer containing vertex indexes.
For vertex buffers storing vertex attribute data, the stride parameter specifies the stride from the beginning of any particular vertex to the beginning to the next consecutive vertex, in bytes. For a vertex buffer storing index data, the stride parameter should be the default value of zero. By default, all vertex attributes are read from the vertex buffer with the index kVertexBufferAttributeArray0. The Renderable::SetVertexBufferArrayFlags function can be used to indicate that some attributes are read from the vertex buffer with the index kVertexBufferAttributeArray1.
See Also

Renderable::SetVertexBufferArrayFlags

Renderable::SetVertexCount