Sign in to follow this  
derek7

I can do = ?

Recommended Posts

given a ID3DXMesh pMesh known and a ID3DXMesh pTemp ;I can do this: pTemp = pMesh;?? or I must do pMesh.CloneMeshFVF(0,pMesh-GetFVF(),device,pTemp);? I find some time just pTemp = pMesh work.

Share this post


Link to post
Share on other sites
It depends if the ID3DXMesh has an operator= in its structure and as far as I know he hasn't have that.

LPD3DXMesh is an pointer to ID3DXMesh, if you use that instead of ID3DXMesh it is possible to do pTemp = pMesh.
If you want to copy the pMesh and put it in pTemp you need to call the clone function.

Share this post


Link to post
Share on other sites
ID3DXMesh is an abstract class, you can't create an instance of it, so I presume your post has a typo, and you actually have pointers.
If that's the case, then the same rules apply for any other pointer. You're not duplicating the object at all, you're just copying the pointer. It will work so long as you don't release the mesh, and anything you do to pMesh will affect pTemp (and vice versa).
If you want to create a copy of the mesh, you want to use ID3DXMesh::CloneMesh() or ID3DXMesh::CloneMeshFVF().

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this