Jump to content
  • Advertisement
Sign in to follow this  
locksleyu

Problem with D3DXLoadMeshHierarchyFromX()

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

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!