Problem with D3DXLoadMeshHierarchyFromX()

Started by
2 comments, last by legalize 15 years, 3 months ago
I am trying to add animation to my mini-engine by using the code from the DirectX 9.0 SDK example 'MultiAnimation', but I am having a problem when D3DXLoadMeshHierarchyFromX() gets called from within CMultiAnim::Setup(). I am getting a E_FAIL return value from D3DXLoadMeshHierarchyFromX() and the following text in the console (with debug build):

D3DX: Unicode support: 1
D3DX: ID3DXEffect::GetInt: Invalid handle
D3DX: ConvertToIndexedBlendedMesh: Zero Palette size not allowed.
It seems the original cause of the failure has to do with the effect, but I see that effect is being created properly in the code right before this. The code in CMultiAnim is unchanged from the MultiAnimation example, the only different is i am using my own effect file instead of "MultiAnimation.fx". I don't quite understand why this would matter, since the effect is not directly used by D3DXLoadMeshHierarchyFromX(), although there is some comments that say palette info is taken from the effect. Does anyone know what may be happening? Also, and easy to understand tutorials or books on the subject would be appreciated. I've been staying away for 3D for some time because I was afraid of the (unnecessary?) complexity involved, and now I see that my fears were well-founded (: Thanks!
Advertisement
A couple of questions:

1) What version of the SDK are you using? D3DX has changed quite a bit over the past couple of years, I recommend you use the most recent SDK if you're using an older one. Most of the changes in D3DX have been bug fixes.

2) You're linking with the debug D3DX library, right?

3) Have you tried putting breakpoints in your implementation of ID3DXAllocateHierarchy and/or ID3DXLoadUserData? This is how D3DXLoadMeshHierarchyFromX collaborates with your app to load the data.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

legalize, thanks for the quick response!

I am using the latest version of the DirectX 9 SDK, and also using the debug D3DX library.

I tried your suggestion #3 and found the first error is happening error:

        m_pMA->m_pEffect->GetInt( "MATRIX_PALETTE_SIZE", ( INT * ) & iPaletteSize );


The odd thing is can't find this variable set anywhere (even in the original SDK example). The closest thing I found was this:

    D3DXMACRO mac[2] =    {        { "MATRIX_PALETTE_SIZE_DEFAULT", "35" },        { NULL,                          NULL }    };


As this code is identical to the sample code, I'm not sure what is going wrong.

Well, what is the error when you call GetInt?

The problem with blindly copying sample code without understanding it is that you're taking that code and shoving it into another context. This is going to be a problem if you don't already understand the code in order to modify it for its new context.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

This topic is closed to new replies.

Advertisement