Entry point error

Kim2

20-11-2008 16:42:21

Hi. I'm trying to integrate nxogre with a project for the first time. I am building everything in release mode and it all builds fine. When I include nxogre.h in my project I get the following error when I try to run:



I am using Ogre 1.4.7 and PhysX 2.8.1.

Please tell me what info I should post if more is needed to understand my problem.

Thanks for any help guys.

penguin

20-11-2008 18:40:18

Last time I had that problem, it was because I was using a different version of the source than I was using OgreMain.dll.

Kim2

20-11-2008 19:00:32

penguin could you please explain what you mean by different version of the source?

I know this problem usually happens when you build something in a certain mode and then use the wrong dll but I can't think how this could be happening here, I build everything under release using the same version of Ogre.

mcaden

21-11-2008 01:38:24

I agree with penguin. Without knowing exactly how things are set up I can't point out exactly where the problem is, but you've built NxOgre and Ogre both from source?

In building things you have the source (.h and .cpp files), static libraries (libs), and DLLS. If the source of the files don't match up you get a mismatch. A function in the DLL doesn't start where your EXE thinks it starts.

Which version of NxOgre?

Is 1.4.7 the only version of Ogre on your computer?

Kim2

21-11-2008 11:10:48

Well, after a few hours of messing around I succeeded in getting rid of Newton SDK from my project and building with NxOgre 1.5.1 and Shoggoth. Seems doubtful that I will actually be able to achieve anything using 1.5.1 judging from the amount of documentation but may as well give it a go.

Is anyone else using 1.5.1? Any good examples? Gonna go look at bloodycake now and see what I can discover.

Thanks for your replies penguin and mcaden.

Edit: Never mind, downgraded to 1.0'22.

mcaden

21-11-2008 13:50:34

I'd recommend 22 for a little bit longer until 1.5 is a bit more robust

betajaen

21-11-2008 13:53:27

until 1.5 is a bit more robust

And actually has been used with Ogre. ;)

Kim2

22-11-2008 11:45:13

I can add primitives to the scene with my own meshes and it works fine but I'm stuck on associating a mesh with convex/trianglemesh bodies.

Shape* collisionShape = NULL;
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file:media/models/Capsule08.mesh.nxs", "Capsule08.mesh.nxs");
collisionShape = new TriangleMesh(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "Capsule08.mesh.nxs"));
NxOgre::Body *mBody = (NxOgre::Body*)mScene->createBody<NxOgre::Body>("Capsule08",collisionShape,Ogre::Vector3(3,2,0), "model: Capsule08.mesh", "mass : 10");


This builds but the program crashes, an error caused by trying to retrieve globalPose (as far as I can tell). I have read about the custom body class but for now I am only interested in syncing the movement of actor and mesh, not adding particle effects or whatever. Or is the custom class necessary for visualization when using your own collision shape?

What I don't really understand is why the mesh is displayed correctly in sync with the movement of the primitive shapes (NxOgre cube etc.) but I get a crash in the case of my own collision shape.

Also, could you please explain what a trianglemesh is? Is it an exact physics shape built from the mesh which allows a concave mesh?

Sorry for my newb questions.

Kim2

22-11-2008 14:06:12

I got it working, messing around with the custom body class now.


NxOgre::Body* bod = (NxOgre::Body*)mScene->createBody<NxOgre::Body>("Capsule08.mesh", collisionShape ,Ogre::Vector3(0,150,100),"mass : 100");


Works fine but when I try to make a body with the custom body class from the nxogre website the mesh isn't displaying. The body is created though.

bod = (NxOgre::Body*)mScene->createBody<MyActor>("Capsule08", collisionShape,Ogre::Vector3(0,0,10), "Capsule08.mesh", "mass : 10");


Any ideas?

mcaden

22-11-2008 14:18:37

From what you've described it looks to me like it can't find your .nxs file.

Looking through your code it looks like you're adding the file to the ResourceSystem wrong. it should be


NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://media/models/Capsule08.mesh.nxs", "Capsule08.mesh.nxs");


Emphasis on "file://...".

Make sure that that media directory is right off your exe directory, otherwise you'll need to do something like "file:://../../media/models/Capsule08.mesh.nxs".

Kim2

22-11-2008 14:36:19

From what you've described it looks to me like it can't find your .nxs file.

Looking through your code it looks like you're adding the file to the ResourceSystem wrong. it should be


NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://media/models/Capsule08.mesh.nxs", "Capsule08.mesh.nxs");


Emphasis on "file://...".

Make sure that that media directory is right off your exe directory, otherwise you'll need to do something like "file:://../../media/models/Capsule08.mesh.nxs".


Yes, you're right. I just edited my post after realizing the error a moment before you replied. Can you help me with the custom body problem?

mcaden

22-11-2008 14:59:29

I believe it should be:

MyActor* bod = (MyActor*) mScene->createBody<MyActor>( "Capsule08;Capsule08.mesh", collisionShape ,Ogre::Vector3( 0,150,100 ), "mass : 100" );

Kim2

22-11-2008 15:51:03

I believe it should be:

MyActor* bod = (MyActor*) mScene->createBody<MyActor>( "Capsule08;Capsule08.mesh", collisionShape ,Ogre::Vector3( 0,150,100 ), "mass : 100" );



OK, I added the second constructor for this to the custom body class and now I have:




Ogre::SceneNode *Capsule08 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Capsule08");
//Ogre::Entity *Capsule = mSceneMgr->createEntity( "Capsule08"+Ogre::StringConverter::toString(counter), "Capsule08.mesh" );
//Capsule08->attachObject( Capsule );

Shape* collisionShape = NULL;
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file: /media/models/Capsule08.nxs", "Capsule08");
collisionShape = new TriangleMesh(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "Capsule08"));

MyActor* bod = (MyActor*) mScene->createBody<MyActor>( "Capsule08;Capsule08.mesh", collisionShape, Ogre::Vector3( 0,150,100 ), "mass : 100" );


When I didn't have the node Ogre was crashing and in the ogre log it said it was looking for the node. So I made the node (not that I understand what is going on). If MyActor has the node and all the entities attached to the node, why do you need to specify the mesh after the comma?

Anyway it is crashing here:


void SceneRenderer::render(const TimeStep& ts) {
if (ts.Delta > 0)
mSources.Each<const TimeStep&>(&RenderableSource::render, ts);
}


Would help me a lot if you could explain briefly how this is meant to work.

Kim2

22-11-2008 21:20:58

I made a whole bunch of objects like this:


Shape* collisionShape2 = NULL;
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file: /media/models/Capsule08.nxs", "Capsule");
collisionShape2 = new Convex(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "Capsule"));

for(int i = 0; i < 1000; i++ ) {
(NxOgre::Body*)mScene->createBody<NxOgre::Body>("Capsule08.mesh", collisionShape2 ,Ogre::Vector3(-300 + i*25,2050,-300+ i*25),"mass : 1000");
}


Just messing around while I wait for some help fixing up the MyActor thing... but the objects only collide with the ground, not each other?

Edit: Guess the trianglemesh is only meant to be static.

mcaden

22-11-2008 21:53:59

file://media

not file: /media



And triangleMeshes need to be static (think a wall or a tree, something you can collide with, but not really move). So either set mass: 0 or static: yes. Otherwise you can use a convex. I'm pretty sure "mass: 100" is what's causing the crash.

Re: Body
Your bodies are going through eachother? Are they in a position to bump? You look to be offsetting each one by 25, 0, 25 so they seem to be pretty far away from eachother.

you can use
mWorld->createDebugRenderer(mSceneMgr);
to see the actual bodies. Make sure the shape/size/position match up.



One thing you might try is using the params class instead of strings so you have a much more explicit control over object creation. It might help you understand/find errors better.

Kim2

22-11-2008 22:26:13

From the log:

NxOgre::Actor::_createActor

Creation of Actor with the identifier 'Capsule08' failed.


Ogre::SceneNode *Capsule08 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Capsule08");
Ogre::Entity *Capsule = mSceneMgr->createEntity( "Capsule08Entity"+Ogre::StringConverter::toString(counter), "Capsule08.mesh" );
Capsule08->attachObject( Capsule );

Shape* collisionShape = NULL;
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://media/models/Capsule08.nxs", "Capsule");
collisionShape = new Convex(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "Capsule"));

MyActor* bod = (MyActor*) mScene->createBody<MyActor>( "Capsule08;Capsule08.mesh", collisionShape, Ogre::Vector3( 0,150,100 ), "mass : 100" );


Still crashing at scenerenderer.

The code I use to create the world and register the factory:


mWorld = new NxOgre::World("time-controller: ogre");
mScene = mWorld->createScene("Scene", "renderer: ogre, controller: accumulator, gravity: yes, floor: yes");
mScene->registerRenderableActorFactory(MyActor::FactoryIdentifier,new MyFactory(),true);


The code for MyActor/factory is the same as on the website..

I enabled the debugger view but it's not going to help much at the moment because the program crashes right away. Will be helpful though.

I assume the objects were intersecting each other because they were trianglemeshes. Sort of threw me off that the trianglemeshes still respond to gravity and the ground plane.

I just want to know if overall the above is the right way to create the actor

Thank you very much for your observations so far.

Kim2

22-11-2008 22:34:17

I'm looking at the params method as well, trying to work out how to set up NodeRenderableParams to pass in.

Edit: had some success:


Ogre::SceneNode *Capsule08 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Capsule08");
Ogre::Entity *Capsule = mSceneMgr->createEntity( "Capsule08Entity"+Ogre::StringConverter::toString(counter), "Capsule08.mesh" );
Capsule08->attachObject( Capsule );

Shape* collisionShape = NULL;
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://media/models/Capsule08.nxs", "Capsule");
collisionShape = new TriangleMesh(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "Capsule"));

NodeRenderableParams renderParams;
renderParams.setToDefault();
renderParams.mGraphicsModel = "Capsule08.mesh";
renderParams.mGraphicsModelScale = NxVec3(1, 1, 1);
renderParams.mIdentifier = "Capsule08";
renderParams.mIdentifierUsage = renderParams.IU_Use;
renderParams.mMode = RenderableSource::RM_Interpolate;

// MyActor* bod = (MyActor*) mScene->createBody<MyActor>( "Capsule08;Capsule08.mesh", collisionShape, Ogre::Vector3( 0,150,100 ), "mass : 100" );

MyActor* bod = (MyActor*) mScene->createBody<MyActor>("ID", collisionShape, Ogre::Vector3( 0,150,100 ), renderParams, "mass: 10");



But this doesn't work when I try to use convex mesh instead of trianglemesh.

Any ideas about why the convex mesh doesn't work? The actual collision shape seems to be created alright, but it fails when I try to make the actor using that shape.

mcaden

23-11-2008 02:46:40


Ogre::SceneNode *Capsule08 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Capsule08");
Ogre::Entity *Capsule = mSceneMgr->createEntity( "Capsule08Entity"+Ogre::StringConverter::toString(counter), "Capsule08.mesh" );
Capsule08->attachObject( Capsule );

Shape* collisionShape = NULL;
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://media/models/Capsule08.nxs", "Capsule");
collisionShape = new Convex(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "Capsule"));

NodeRenderableParams renderParams;
renderParams.setToDefault();
renderParams.mGraphicsModel = Capsule->getName();
renderParams.mGraphicsModelScale = NxVec3(1, 1, 1);
renderParams.mIdentifier = Capsule08->getName();
renderParams.mIdentifierUsage = renderParams.IU_Use;
renderParams.mMode = RenderableSource::RM_Interpolate;

MyActor* bod = (MyActor*) mScene->createBody<MyActor>( renderParams.mIdentifier, collisionShape, Ogre::Vector3( 0,150,100 ), renderParams, "mass: 10" );


That should do it.

My only other question is...Is Capsule08.nxs a triangle mesh or a convex mesh? Same extension, different files. Which one did you make it as? It can only serve one format.

TriangleMesh's can only be static. They have 0 mass and don't react to forces. They aren't affected by gravity.

actorParams.mMass = 0;
actorParams.Static( true );

Although I believe this is slightly overkill as anything with 0 mass is automatically static.


Convex meshes don't have to be static and can react to forces.

Kim2

23-11-2008 06:22:48

Oh damn, you're right! I built it as a trianglemesh, it's very likely not working because of that. Ah well, live and learn. I'll fix it now.

Edit: Yep, it's working now. Finally! Thank you heaps for all your help.

Now to try making a compound system.

Kim2

23-11-2008 06:53:17

Hm, when I set "gravity: no" it doesn't seem to disable gravity for my objects. Do you need to disable gravity on a per-object basis?

mcaden

23-11-2008 07:02:15

hmm..."gravity: no" should do it I think

try

mScene->setGravity( Vector3(0, 0, 0) );

Kim2

23-11-2008 09:11:42

Thanks, that did the trick.