Microsoft DirectX 8.1 (Visual Basic)

Index Buffers

Index buffers, represented by the Direct3DIndexBuffer8 class, are memory buffers that contain index data. Index data, or indices, are integer offsets into vertex buffers and are used for rendering primitives using the Direct3DDevice8.DrawIndexedPrimitive method.

VertexBuffers and index buffers are orthogonal concepts, that is, you can use indexed primitives with or without vertex buffers, or you can use a vertex buffer with or without indexed primitives.

Index buffer descriptions tell your application how an existing buffer was created. You provide an empty description structure for the system to fill with the capabilities of a previously created index buffer. For more information about this task, see Access the Contents of an Index Buffer.

The Format member describes the surface format of the index buffer data.

The Type identifies the resource type of the index buffer.

The Usage structure member contains general capability flags. The D3DUSAGE_SOFTWAREPROCESSING flag indicates that the index buffer is to be used with software vertex processing. The presence of the D3DUSAGE_WRITEONLY flag in Usage indicates that the index buffer memory is used only for write operations. This frees the driver to place the index data in the best memory location to enable fast processing and rendering. If the D3DUSAGE_WRITEONLY flag is not used, the driver is less likely to put the data in a location that is inefficient for read operations. This sacrifices some processing and rendering speed. If this flag is not specified, it is assumed that applications perform read and write operations on the data in the index buffer.

Pool specifies the memory class allocated for the index buffer. The D3DPOOL_SYSTEMMEM flag indicates that the system created the index buffer in system memory.

The Size member simply stores the size, in bytes, of the vertex buffer data.

Additional information is contained in the following topics.