does ogrenewt2.0 surport ogre1.7?

caifie

12-04-2010 06:42:10

hi, every one!

i'm using the ogre1.7 and newton 2.18, and i have download the ogrenewt2.0 from the svn, and combiled it writly, and have the ogrenewt_d.lib.

the problem is that, it will shut down when i using it in ogre1.7.

my code is below, combile well but run wrong.
Ogre::Vector3 size(10.0,1.0,10.0);
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::Entity* ent = mSceneMgr->createEntity( "floorobj", "box.mesh" );
node->attachObject( ent );
node->setScale( size );

OgreNewt::CollisionPtr col( new OgreNewt::CollisionPrimitives::TreeCollision( m_World, ent, true, 0));

OgreNewt::Body* floorbody = new OgreNewt::Body( m_World, col );
floorbody->attachNode(node);

floorbody->setPositionOrientation( Ogre::Vector3(0,-5,0), Ogre::Quaternion::IDENTITY );

// BOX
size = Ogre::Vector3( 10, 10, 10 );
node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
ent = mSceneMgr->createEntity("box_body", "box.mesh" );
node->attachObject( ent );
node->setScale( size );

// rigid body.
OgreNewt::CollisionPrimitives::Box *boxcol = new OgreNewt::CollisionPrimitives::Box(m_World, size, 0);
col = OgreNewt::CollisionPtr(boxcol);
OgreNewt::Body* bod = new OgreNewt::Body( m_World, col );
bod->attachNode( node );

// initial position
bod->setPositionOrientation( Ogre::Vector3(-2,20,2), Ogre::Quaternion::IDENTITY );

Ogre::Real mass = 10.0;
Ogre::Vector3 inertia, centerOfMass;
boxcol->calculateInertialMatrix(inertia, centerOfMass);

inertia*=mass;

bod->setMassMatrix( mass, inertia );
bod->setCenterOfMass(centerOfMass);

bod->setStandardForceCallback();


when i run, it will shutdown and die at the line,
OgreNewt::CollisionPrimitives::Box *boxcol = new OgreNewt::CollisionPrimitives::Box(m_World, size, 0);

and the error text:
Unhandled exception at 0xC0000005 in test_ogrenewt.exe:0x00c31400: Access violation reading location 0x3f800000
Unhandled exception at 0xC0000005 in test_ogrenewt.exe:0x00c31400: Access violation reading location 0x3f800000


ps: i have built the newton world and include the required head files.

does anyone kown this? tell me how to do.
thanks!

mengzhu

12-04-2010 09:38:56

The codes I learned in demos is always like these:
OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 ));
OgreNewt::Body* body = new OgreNewt::Body( m_World, col );

Seems kalla havn't claimed OgNewt2 has updated totally ,but most of code except relates to cegui can work with Og1.7; I think both OgNewt2 and Ogbullet should have a specified topic or blog on compiling progress/dependencies/changes news etc,else newbies will ask these frequently;I'm a noob too :lol: ;especially for OgBUllet,I can compile the SVN code,but can't find some resource needed,fish,you havnt replied me yet~ :cry:

caifie

12-04-2010 11:27:49

thaks for your reply, :D
The codes I learned in demos is always like these:
OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 ));
OgreNewt::Body* body = new OgreNewt::Body( m_World, col );

Seems kalla havn't claimed OgNewt2 has updated totally ,but most of code except relates to cegui can work with Og1.7; I think both OgNewt2 and Ogbullet should have a specified topic or blog on compiling progress/dependencies/changes news etc,else newbies will ask these frequently;I'm a noob too :lol: ;especially for OgBUllet,I can compile the SVN code,but can't find some resource needed,fish,you havnt replied me yet~ :cry:



yes, i know the code has changed. above is just an example.
when i change the code with
OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 ));
OgreNewt::Body* body = new OgreNewt::Body( m_World, col );


it will also die at
OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::Box( m_World, size, 0 ));


and a strange thing is that , if i creat an empty ogre1.7 progrom, and import the demo code without cegui which can run(debug) in the ogrenewt.sln, it can combile but can not run too.

take Demo03_CollisionCallbacks for example, the progrom imported will die at the same code line
OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floor, true, 0 ));

SFCBias

19-04-2010 16:46:54

Im having the exact same problem and im playing with the code to try to find out whats wrong but im too new to OgreNewt for me to really do much :?

kallaspriit

24-04-2010 18:24:14

Does the MinimalOgreNewtApplication demo compile with 1.7? It does not use any special features of Ogre, neither does it use Cegui. What does the stack trace point to?

caifie

28-04-2010 03:19:10

thanks kallaspriit for the reply!

yes, the MinimalOgreNewtApplication demo can compile with 1.7, and it can debug well.

the funny thing is that, the same code fragment, which can combile and run in the OgreNewt.sln, but can not combile in a new ogre1.7 progrom.

ps: the progrom property, additonal libs and so on in the new ogre1.7 progrom, are same as the OgreNewt.sln. i have checked them.