C4 Engine
C4 Engine API Documentation

SharedVertexBuffer::Retain

Defined in:  C4Renderable.h
Retains a reference to a shared vertex buffer.
Prototype

int32 Retain(void);

Description
The Retain function increments the reference count for a shared vertex buffer and returns the new reference count. This function takes no other action.

If the returned reference count is one, then the caller has retained the first reference to the shared vertex buffer. In this case, the calling code should allocate the buffer's resources using the VertexBuffer::EstablishVertexBuffer function and define the vertex buffer's data using either the VertexBuffer::BeginUpdate function or VertexBuffer::UpdateBuffer function.

When the owner of the retained reference is finished using the vertex buffer, it should call the SharedVertexBuffer::Release to release its reference, allowing the vertex buffer's resources to be deallocated if there are no other references.

The initial reference count for a shared vertex buffer is zero.
See Also

SharedVertexBuffer::Release