Fail to clone a mesh using CloneMeshFVF()
The book I'm studying tells that A secondary Mesh container is needed because the original interface ID3DXMesh that D3DXLoadSkinMeshFromXof() loads into is the base Mesh that we refer to and we should not change the original vertex coordinates. Then my book tries to use CloneMeshFVF() to create a secondary Mesh object. I've tried its sample and then I failed to clone a mesh with it. The following is the way the example codes call this function.
--
DWORD fvftype = pMesh->MeshData.pMesh->GetFVF();
DWORD options = pMesh->MeshData.pMesh->GetOptions();
if(pMesh->pSkinInfo)
pMesh->MeshData.pMesh->CloneMeshFVF( options, //D3DXMESH_MANAGED,
fvftype,
pDevice, &pMesh->pSkinMesh);
--
The code fails to assign pMesh->pSkinMesh an address (the fvftype == 0 and return NULL). Then I've tried to change the 2nd argument to (fvftype | D3DFVF_NORMAL). It succeeded. But then pMesh->pSkinMesh->DrawSubset() can't render anything. Could anyone tell me why? Thanx.
So you're saying the incoming FVF, fvftype, is zero? Which would indicate that its not in a vertex format expressable via the FVF system (e.g. it includes tangents/bitangents). Try using the regular CloneMesh() and use GetDeclaration() instead of GetFVF().
Alternatively, run it against the debug runtimes and see what output you get - if a function fails then the debug runtimes will almost always tell you why [wink]
hth
Jack
Alternatively, run it against the debug runtimes and see what output you get - if a function fails then the debug runtimes will almost always tell you why [wink]
hth
Jack
I've debuged the sample code with my VC6.0 debuger program and when I ran step-by-step debugging under this code section, the context window showed that zero value. So, I kinda don't know what you mean by your 2nd setence. Doesn't the debug runtime only tell you the problems on the avaiable source code files that have kept debugging infomation in the debug-mode compilation? Therefore, how can I easily know what's wrong with the execution of interfaces like CloneMeshFVF which are provided by the library?
I've tried the CloneMesh() and it works! Thanx a lot!
I've tried the CloneMesh() and it works! Thanx a lot!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement