IrrODE issue

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
Pianist
Posts: 14
Joined: Wed Apr 22, 2009 12:47 pm
Location: Czech Republic

IrrODE issue

Post by Pianist »

Hello,

I'm starting using ODE engine wrapped with IrrODE in c++ based project for Irrlicht visualisation. My example is inspired by hello ode world vc tutorial.

It seems that my project is set properly, because compilation and linking work. Application crashes during initialization of scene. My code workflow is as follows:

Code: Select all

IrrlichtDevice *device=createDevice(EDT_DIRECT3D9, dimension2d<u32>(640,480),16,false,false,false,0);

IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();

CIrrOdeSceneNodeFactory cFactory(smgr);
smgr->registerSceneNodeFactory(&cFactory);

CIrrOdeManager::getSharedInstance()->install(device);

 //init the ODE
CIrrOdeManager::getSharedInstance()->initODE();
CIrrOdeManager::getSharedInstance()->initPhysics();

//world definition
ISceneNode *pNode=smgr->addSceneNode(
                    CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_WORLD_NAME),
                    smgr->getRootSceneNode());
CIrrOdeWorld *worldNode=reinterpret_cast<CIrrOdeWorld *>(pNode);
CIrrOdeWorld *worldNode=reinterpret_cast<CIrrOdeWorld *>(pNode);
worldNode->setGravity(vector3df(0,-10,0));

IAnimatedMesh *Mesh=smgr->getMesh("box.3ds");
IAnimatedMeshSceneNode *Node=smgr->addAnimatedMeshSceneNode(Mesh,worldNode);
Node->setMaterialTexture(0,driver->getTexture("box0.jpg"));
Node->setScale(vector3df(15.0f,1.5f,15.0f));
Node->setMaterialFlag(EMF_LIGHTING, false);

CIrrOdeGeomBox *bx=reinterpret_cast<CIrrOdeGeomBox *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_BOX_NAME),
                     Node));

//here occurs an ERROR : wrong memory allocation

bx->getSurfaceParameters(0)->setBounce(1.0f);
bx->getSurfaceParameters(0)->setModeBounce(true);
bx->drop();

//as the last part we add a sphere geom as child of the 
//AnimatedMeshSceneNode
CIrrOdeGeomSphere *pSphere=reinterpret_cast<CIrrOdeGeomSphere *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(
  IRR_ODE_GEOM_SPHERE_NAME),Node));
pSphere->setMassTotal(0.5f);
pSphere->getSurfaceParameters(0)->setBounce(1.0f);
pSphere->getSurfaceParameters(0)->setModeBounce(true);
pSphere->drop();

worldNode->initPhysics();
From my tracking job I have a few notes:

1. an error occurs when the second scene node is creating
(for this example it is bx box)
smgr->addSceneNode...

[CSceneManager.cpp]
SceneNodeFactoryList->addSceneNode(sceneNodeTypeName, parent);

[CIrrOdeGeomBox->CIrrOdeGeom]

m_iMass=m_pOdeDevice->massCreate();

[CIrrOdeDevice.cpp]
m_pOdeData.push_back(wrap); //here occurs memory allocation error

there is problem in reallocation memory.

Does anybody have similar experience with this issue?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Erm, I don't know anything about ode, but you should really read the rules before you post, you're in a wrong forum.
Next time post these kind of questions in the beginners section or irrODE's thread.
Working on game: Marrbles (Currently stopped).
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

init after you create your objects :roll: Next time at least try to look at a tutorial before you post.
multum in parvo
newleon
Posts: 19
Joined: Mon Jan 10, 2011 7:59 am
Location: Pohang, South Korea
Contact:

Post by newleon »

@Pianist:
I think I understand your problem because I had the same issue with IrrOde. In my opinion your mistake is in compiling original ode-0.11.1. You should change project configuration from DebugDoubleDLL to DebugSingleLib. I explained it in more detail here:
http://irrlicht.sourceforge.net/phpBB2/ ... &start=465
I hope it helps you.

EDIT: It might be a good idea to post this in the IrrOde thread over at the Project Announcements forum, your question will get more attention there.
Post Reply