Sign in to follow this  

trouble filling the mesh container

Recommended Posts

hi im tring to load the tiny.x file. in the CreateMeshContainer(LPCTSTR Name, const D3DXMESHDATA *pMeshData, const D3DXMATERIAL *pMaterials, const D3DXEFFECTINSTANCE *pEffectInstances, DWORD NumMaterials, const DWORD *pAdjacency, LPD3DXSKININFO pSkinInfo, LPD3DXMESHCONTAINER *ppMeshContainer)" call back function i fill in the mesh container data and to local mesh container local variable and assign it to the ppMeshContainer in the following way *ppMeshContainer = (D3DXMESHCONTAINER*)pMeshContainer; when i debug i see that the correct values have been passed on to *ppMeshContainer i try to access this info from a different location after i filled in this data but all i recive is null. any reason for this does directX release this data ??? i tried to access the data like this void TD3DMultiMesh::ProcessSkinFrame(LPD3DXFRAME pFrame) { D3DXFRAME_MATRIX * pMtxFrame = (D3DXFRAME_MATRIX*)pFrame; D3DXMESHCONTAINER_DERIVED * pContainer = (D3DXMESHCONTAINER_DERIVED*)pFrame->pMeshContainer; TD3DMesh * pMesh ; ..... pFrame->pMeshContainer this just returns NULL. but the pFrame does pass in a valid frame. can any one help me on this

Share this post

Link to post
Share on other sites
DirectX doesn't release the data. Your code destroys it. Even then, the value of the pointer will not be NULL, unless you set it to NULL.

You may have several problems. One problem may be how you define D3DXMESHCONTAINER_DERIVED and the other how you define D3DXFRAME_MATRIX. Those classes must be based on D3DXMESHCONTAINER and D3DXFRAME correctly.

Post your code where you define D3DXMESHCONTAINER_DERIVED and D3DXFRAME_MATRIX, and the code for your CreateMeshContainer function.

They should look something like:
class D3DXFRAME_MATRIX : public D3DXFRAME {...}

Also, in your CreateMeshContainer function, do you have:

ZeroMemory(pMeshContainer , sizeof(D3DXMESHCONTAINER_DERIVED));
*ppMeshContainer = (D3DXMESHCONTAINER*)pMeshContainer;

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