I turned culling off and got the same result.
As for 16 bit indices... that could very well be it. They are 32-bit ints at the moment. But I''m sure I set it to use 32bit indices. Don''t tell me that flag isn''t supported.
Here''s more code. This chunk creates the vertex buffer and copies the vertices into it. It also shows the render routine for a mesh:
IM_RESULT imMesh::CopyVertices (imBasicVertex *Vertices, LPDIRECT3DDEVICE8 pDevice){ imBasicVertex *pVertices; if (FAILED (pDevice->CreateVertexBuffer(NumVertices * sizeof(imBasicVertex), 0, D3DFVF_IMBASICVERTEX, D3DPOOL_DEFAULT, &pVB))) return IM_FAIL; if (FAILED (pVB->Lock(0, 0, (BYTE**)&pVertices, 0))) return IM_FAIL; for (int i = 0; i < NumVertices; i++) { pVertices[i].x = Vertices[i].x; pVertices[i].y = Vertices[i].y; pVertices[i].z = Vertices[i].z; pVertices[i].nx = Vertices[i].nx; pVertices[i].ny = Vertices[i].ny; pVertices[i].nz = Vertices[i].nz; pVertices[i].u = Vertices[i].u; pVertices[i].v = Vertices[i].v; } pVB->Unlock(); return IM_SUCCESS;}void imMesh::Render (LPDIRECT3DDEVICE8 pDevice){ pDevice->SetStreamSource (0, pVB, sizeof(imBasicVertex)); pDevice->SetVertexShader (D3DFVF_IMBASICVERTEX); for (int i = 0; i < NumPolysets; i++) Polysets[i].Render (pDevice);}
This is the bit that copies indices and actually renders the triangles:
IM_RESULT imPolyset::CopyIndices (unsigned int *IndsArray, LPDIRECT3DDEVICE8 pDevice){ int *pIndices; if (FAILED (pDevice->CreateIndexBuffer(NumPolys * 3 * sizeof (int), D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_MANAGED, &pIB))) return IM_FAIL; if (FAILED (pIB->Lock(0, 0, (BYTE**)&pIndices, 0))) return IM_FAIL; for (int i = 0; i < NumIndices; i++) pIndices[i] = (int) IndsArray[i]; pIB->Unlock(); return IM_SUCCESS;}void imPolyset::Render (LPDIRECT3DDEVICE8 pDevice){ // Need material setup stuff here pDevice->SetMaterial( &Surface ); pDevice->SetIndices (pIB, 0); pDevice->DrawIndexedPrimitive (D3DPT_TRIANGLELIST, 0, NumIndices, 0, NumPolys);}
I hope it does support 32 bit indices. Otherwise I''ll have to go change my file format.
Thanks for the help so far.
Never eat anything bigger than your own head.
--------------------Never eat anything bigger than your own head.