Jump to content
  • Advertisement
Sign in to follow this  
robert p

Creating a ID3DXMesh from a list of vertices

This topic is 4088 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!