Im building an octree engine that will load up a .x file mesh and extract all the data and then render it using an Octree for culling. Ive extracted the mesh vertex buffer materials and textures. Now im trying to create and index buffer for each material, but im getting access violations when trying to lock the index buffers here what im doing
these are in the header
LPDIRECT3DINDEXBUFFER8 *OctreeIndex;
int *NumIndices;
create the index buffers
OctreeIndex = new LPDIRECT3DINDEXBUFFER8[TableSize];
NumIndices = new int[TableSize];
device->CreateIndexBuffer(65535,
D3DUSAGE_WRITEONLY,
D3DFMT_INDEX16,
D3DPOOL_DEFAULT,
&OctreeIndex[i]);
and heres the non working lock
unsigned short *ind;
for(int i=0;i<(int)NumMaterials;i++)
{
OctreeIndex[i]->Lock(0,0,(BYTE**)&ind,0);
}
cant see whats wrong but maybe some one else can thanks