Archived

This topic is now archived and is closed to further replies.

changing a mesh's FVF

This topic is 5388 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

the following code attempts to change the meshes fvf, but it causes my app to crash, where mesh->pMesh is a pointer to a mesh class, should this work? or should i make a copy of the oringonal mesh before tying to change itself?!
mesh->pMesh->CloneMeshFVF(D3DXMESH_WRITEONLY, D3DFVF_QUADFVF, pD3DDevice, &mesh->pMesh);
  
edit: also tryed this, but it dont work:
	LPD3DXMESH pTempMesh;

	mesh->pMesh->CloneMeshFVF(D3DXMESH_WRITEONLY, D3DFVF_QUADFVF, pD3DDevice, &pTempMesh);
 
[edited by - supagu on March 15, 2003 8:37:25 PM]

Share this post


Link to post
Share on other sites
You sould consider the vertex format!

I think it is because the cloned mesh's vertex struct size is small than the original's;

Or do this job yourself:

1,Create a empty mesh with your FVF;
2,Lock vertex buffer of the original mesh and newly created mesh;
3,Do vertices' copy manually;
4,Unlock;
5,Copy other info(metrial,texture,etc...)


We create world.

[edited by - kimryo on March 15, 2003 12:22:17 AM]

Share this post


Link to post
Share on other sites
If your original mesh is write only, then it may not clone successfully. Grab the return code of CloneMeshFVF and check with the error lookup to see what''s going on.

Share this post


Link to post
Share on other sites