Original Post
Hi, I have a problem that is a bit tricky. I am loading in one (or more) dirext .x meshes at runtime. The meshes of each object are stored in an apporpriate mesh, then I use LockVertexBuffer to read in the vertex positions of each mesh into a double pointer of CUSTOMVERTEX. When I print the vertices to the screen I get spurious results. I'm sure I'm doing something wrong but not sure what it is. I was hoping someone might help me. The code for it is below:
// double pointer to CUSTOMVERTEX
CUSTOMVERTEX **pVertexMesh;
// directx meshes
LPD3DXMESH g_pMesh[MAX_MESHES]= {NULL};
//allocate memory for pointers
pVertexMesh = (CUSTOMVERTEX**) calloc(numMeshes * numVerts, sizeof(CUSTOMVERTEX*));
for (int mesh = 0; mesh <= iMeshCount-1; mesh++) {
// read in the vetices of each morphable mesh
g_pMesh[mesh]->LockVertexBuffer(D3DLOCK_READONLY, (LPVOID*)&pVertexMesh[mesh]);
g_pMesh[mesh]->UnlockVertexBuffer();
}
sprintf(old, "sumX = %5.2f", pVertexMesh[0][2].position.x);
The first vertex (pVertexMesh[0][0].position.x) displays correctly but subsequent vertices (pVertexMesh[0][1,2,3....].position.x) do not. Thanks, Thomo.