Crash using createMeshCopy

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Mikhail9
Posts: 54
Joined: Mon Jun 29, 2009 8:41 am

Crash using createMeshCopy

Post by Mikhail9 »

I am having trouble with IMeshManipulator::createMeshCopy. The following code (where ism is the ISceneManager*):

Code: Select all

IMesh* mesh = ism->getMesh("mymesh.x")->getMesh(0);
SMesh* clone = ism->getMeshManipulator()->createMeshCopy(mesh);
crashes. I have traced this to the point where createMeshCopy tries to copy the SMeshBuffer, and it actually blows up trying to copy materials (one is 0xFFFFFFFF).

This is exactly the same problem discussed here:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=32959
and I think I understand that topic, but there's no solution there to help me here.

Is there a way I can copy this mesh without things blowing up?

Thanks.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

It would be very useful if you could provide a simple testcase (modify one of the tutorials if necessary) that illustrates the problem. If necessary, you might need to provide a sample mesh.

Travis
Mikhail9
Posts: 54
Joined: Mon Jun 29, 2009 8:41 am

Post by Mikhail9 »

No problem. I thought maybe this was a known thing there was an easy answer to. Maybe there still is.

I have modified the 01.HelloWorld code to demonstrate the problem. Look for the Interesting Part in the code and comment in or out some different cases.

I have included a sample .x file of mine (and an abridged texture), as well as one from the SDK. Both cause the createMeshCopy() function to crash.

I would like this to work. I really need to make a copy of this mesh.

Thanks for looking at it.

Files are here: http://www.filefactory.com/file/ahaae90 ... evised_zip (annoying, is there a better place to use?)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

IIRC this was a bug due to a wrong cast in the createMeshCopy (which insisted on working on an SMesh whereas .x files use CSkinnedMesh). This should be fixed, though, but maybe only in SVN/trunk.
Mikhail9
Posts: 54
Joined: Mon Jun 29, 2009 8:41 am

Post by Mikhail9 »

You're right. It is fixed there. The version of CMeshManipulator::createMeshCopy() in the SVN trunk doesn't cause a crash when cloning .x files.

Thanks!
Post Reply