• Advertisement
Sign in to follow this  

Creating a ID3DXMesh from a list of vertices

This topic is 3880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a wierd problem creating a ID3DXMesh from an array of vertices. The problem is that when I call LockVertexBuffer and try to copy the points I overrun the end of the pointer they give me to write into, but I'm confused because I just created the mesh and used the same variable for the number of vertices for it to be created with. I think I'm confused how CreateMesh works but I'm not really sure. Anyways this is the code I have, I've changed the amount of vertices around I know it's not too many. And I know the vertices are good because I was drawing them not in a D3DXMesh before. Also I copy the indices just fine, I'm just trying to get this to work so right now so they are in a list like 0,1,2,3,4,5,6... Here is my code D3DXCreateMeshFVF(numMeshFaces, numMeshVerts, 0, VERTEX_FVF, device, &pMesh); Vertex *verts; pMesh->LockVertexBuffer(0, (void **)&verts); for(int j = 0; j < numMeshVerts; j++) verts[j] = originalVerts[j]; // Crashes right here, over runs the end of they verts array // about 2/3 of the way through, // but I just created the mesh with the same numMeshVerts amount // of vertices ??!!?? pMesh->UnlockVertexBuffer();

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement