Archived

This topic is now archived and is closed to further replies.

dev-c++ + directx9 + skinmeshes = segfault why?

Recommended Posts

I''ve been failing to get skinmeshes to work in my direct3d game for 2 weeks now, I think I finnaly got my head around the SDK sample skining program but I wish the MSDN tutorials covered it, they made sence... Anyway on to my problem, I try to load the mesh and I get a segmentation fault, (access violation) I used debug mode in dev-c++ and it can''t find the function it''s currently in when the fault happens so I think it must be in the pre-compiled code from the dev-c++ devpak for directx9, to test this I tried to get the sample sdk to compile, (why do they have to put in so much crap? are they trying to make it hard to compile the samples?) anyway I think I got that working, it has the segmentation fault in the same place though... The fault seems to happen in D3DXLoadMeshHierarchyFromX() after it calls ID3DXAllocateHierarchy::CreateFrame(), (debug steps through that fine first) and before it calls any of the other functions in ID3DXAllocateHierarchy or ID3DXLoadUserData, (I''ve tried both NULL in the call to D3DXLoadMeshHierarchyFromX() and empty functions for ID3DXLoadUserData) anyone gotten skinning to work in directx 9 with dev-c++? is there an easier way to load skins than D3DXLoadMeshHierarchyFromX()? I don''t want to have to deal with the xfileEnumeration crap.

Share on other sites
Hello? can I get some help? don''t mean to bug you people but since the sample that comes with the SDK segfaults I''m beyond confused.

Share on other sites
That is pretty weird... Have you tried reinstalling the sdk and devpak?

Share on other sites
I just re-installed all of dev-c++, (now 4.9.8.1) and the sdk (now 9.0b), now it warns me that ofstream is outdated... oh well it's just in there for debuging.

now the SDK sample seems to load alot of the frames then crashes trying to "SAFE_RELEASE(m_pIndexedVertexShader[iInfl]);" in CMyD3DApplication::InvalidateDeviceObjects()

My project on the other hand seems to crash after loading the first frame still...

I'm trying to get a nice simple, small system for loading the skinned mesh tiny from the sdk can someone please look at my code and tell me what I'm doing wrong?
my 2 classes are here:

http://locker.goingplatinum.com/~drdlord/myskinning.ace

this the right way to post them?

Hope someone can explain to me why it doesn't work.

[edited by - drdlord on August 9, 2003 3:46:03 PM]

Share on other sites
It would help if you could convert that to the zip file format. Not everyone has WinAce...

Share on other sites
changed to a zip:
http://locker.goingplatinum.com/~drdlord/myskinning.zip

[edited by - drdlord on August 11, 2003 6:04:50 PM]

Share on other sites
Have you tried using the modularized skin-mesh code found on flipcode? I haven''t presonally tried it, but it''s much more nicely organized, so it''ll at least be easier to find where the problem is...

Otherwise you might try the code in the skin-mesh article here on GDN.

Share on other sites
havn't looked at flipcode yet but the gamedev artical I found "Implementing Skin Meshes with directx 8" I found more complicated, it goes through the x file's enumeration, the SDK doesn't seem to need that.

(rant) Be nice if M\$ would implement "D3DXLoadSkinMeshFromX" (notice the lack of "of" at the end?) should be easy for them to do they can load skinmeshes from just a filename in "D3DXLoadMeshHierarchyFromX" and static meshes in "D3DXLoadMeshFromX" (/rant) oh well

I'm just looking for a VERY MINDNUMMINGLY SIMPLE way of loading a skinned mesh, (or if someone can tell me where I messed up in the code I posted that would work)

[edited by - drdlord on August 11, 2003 8:13:03 PM]

Share on other sites
I''m not certain this should work:
class Mesh: public ID3DXAllocateHierarchy, ID3DXLoadUserData...if(FAILED(D3DXLoadMeshHierarchyFromX( fileName, D3DXMESH_MANAGED,                                         device, this, this,                                         &m_pFrameRoot,                                         &m_pAnimController )))

This might not be the problem, but I''m not sure those methods will map up the way they should oughta, with multiple bases. But, if the SDK sample''s still crashing, then this probably isn''t the problem.

If you''re not loading user data in line with the x file data, you should pass NULL to the LoadUserData parameter. Your LoadUserData methods need to return D3D_OK anyway. Your compiler isn''t catching those?

I like pie.

Share on other sites
thanx for the suggestion, was using the ID3DXLoadUserData just to see how far it got before crashing, sperated into 3 clases now and re-uploaded. still crashes after the first call to CreateFrame, (mesh.txt contains:

got to line 31 in mesh.cpp

got to start of CreateFrame in meshloader.cpp
got to end of CreateFrame in meshloader.cpp

the sdk''s sample isn''t crashing in the same place anymore, it can load alot of frames, but it won''t run fully as it crashes in CMyD3DApplication::InvalidateDeviceObjects() before I can see anything load.

Share on other sites
well I looked over the sdk source again... mabey I''m blind but I can''t figure out what I''m doing wrong... can someone help me? code at:
http://locker.goingplatinum.com/~drdlord/myskinning.zip

Share on other sites
Looking at your source, I can''t see anything inherently wrong. Do you not have a debugger? Seeing the call stack would help the most.

When I derive interface methods, I always outline them the way they''re declared in the headers:
STDMETHOD( CreateFrame )( THIS_ LPCSTR Name, .... );

Then in the implementation, like you have them, but with the THIS_:
HRESULT CAllocateHierarchy::CreateFrame( THIS_ LPCSTR Name, ..)

Some of these may get macro''d out, but they may establish a calling convention you need. Maybe your compiler doesn''t check it? That''s the only advice I can give at the moment.

I like pie.

Share on other sites
NICE IT WORKS!!!!!!

thank you! I don''t understand why STDMETHOD(CreateFrame)(THIS_ helps but it does.

BTW for some reason an unnamed frame gets a null pointer instead of a pointer to a null character like most strings... so had to add an if too.

As for a debuger I have one but it''s sorta buggy, it works fine on my code but it doesn''t give me any information when the precompiled stuff craps out, (and the segfault was happening outside of my code, obviously caused by my code though)

Share on other sites
STDCALL may put a __cdecl or other convention in. I suspect your compiler doesn''t give good warnings about that.

Good to hear it''s working.

I like pie.

• Forum Statistics

• Total Topics
628345
• Total Posts
2982200

• 9
• 9
• 24
• 10
• 9