Microsoft DirectX 8.0 (Visual Basic) |
Create an index buffer object by calling the Direct3DDevice8.CreateIndexBuffer method, which accepts five parameters. The first parameter specifies the index buffer length, in bytes.
The second parameter is a set of usage controls. Among other things, its value determines whether the vertices being referred to by the indices are capable of containing clipping information. To improve performance, specify D3DUSAGE_DONOTCLIP when clipping is not required.
The third parameter is either the D3DFMT_INDEX16 or D3DFMT_INDEX32 member of the CONST_D3DFORMAT enumerated type that specifies the size of each index.
The fourth parameter is a member of the CONST_D3DPOOL enumerated type that tells the system where in memory to place the new index buffer.
The following Visual Basic code example shows what creating a index buffer might look like in code.
' ' For the purposes of this example, the m_D3DDevice variable is ' an IDirect3DDevice8 interface exposed by a Direct3DDevice ' object. IB is a variable of type Direct3DIndexBuffer8. ' Set IB = m_D3DDevice.CreateIndexBuffer(16834, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT)