Memory problem with NX_ogre

TheBlindMaster

03-03-2009 02:03:30

Well, after coming trough a lot of problems setuping NxOgre in VC++2005, wich I've been all able to solve by searching the forums or by trying different things, I've now come across one wich I'm quite clueless about, here it is.

when I start rendering (using the root, startRendering function) I get this error : Exception non gérée à 0x021261c4 (NxOgre_d.dll) dans TennisVR.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x00000000. Well rough traduction :
Unhandled error at 0x021261c4 (NxOgre_d.dll) in TennisVR.exe : 0xC0000005: Reading violation at 0x00000000.

So I've tried to trace back the error, but the deepest that I could go in the code is :

template <typename _A>
BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A), _A _1) {

if (_Flat->_size() == 0)
return;

for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin) {
(*begin->*MethodPtr)(_1);
}

}
wich bug in the for loop, I assume for now that the code is ok since, well it's a tutorial, I think it's rather comming from the config, or compiler or linker setting, would any one have an idea about this?

thank you in advance

nargil

03-03-2009 07:36:51

Maybe you use different versions of .lib / .dll / .h ?
Have you ever used / compiled another NxOgre version than you're using now ? Double check the lib directories.

TheBlindMaster

04-03-2009 00:48:15

well .. I've checked that out, and .. well there was some confusion amongst theses files.. yes.. but I still have got something else, (or it's the same thing just that I can see clearer where it fail since I use the debug version of the dll, dunno.. )

well it fail the same way (not same adresses) but I can see that it block at:

void RenderableSource::render_Absolute(const TimeStep& ts) {
mRenderPose = getSourcePose(ts);
--> mRenderable->setPose(mRenderPose);
}

in nxogrerenderablesource.cpp

and it seems like mRenderable isn't defined or, well there's no specified renderer in it (well ... like "", empty string). but if I remove the NXOGRE thing and only keep the ogre parts from the tutorial, it don't fail.. and well it use to fail like that (before I fixed it) when setting the Ogre rendersystem.

thanks in advance!!


I'm going to ad something wich might help ...

here is the NxOgre Code,

mWorld = new NxOgre::World("time-controller: ogre");
NxOgre::Scene* mScene = mWorld->createScene("Paris", pSceneManager, "gravity: yes, floor: yes");

NxOgre::Body* mBody = mScene->createBody("OgreHead.mesh", new NxOgre::Cube(0.5f), Ogre::Vector3(5,30,5), "Mass: 50");

Well.. when I look at mBody, after this code has been executed... well mNodeRenderable is NULL (well == 0x00000000000000)

so that may be the problem (I assume, when there's a pointer pointing to null.. it's just not good)..

I'm gonna add the way I set the renderer

RenderSystem *rs = pRoot->getRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"

rs->setConfigOption("Full Screen", "No");
rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
pRoot->setRenderSystem(rs);

I've tried it with direct3d and opengl.. both the same error..

nargil

04-03-2009 07:51:04

NxOgre::Body* mBody = mScene->createBody("OgreHead.mesh", new NxOgre::Cube(0.5f), Ogre::Vector3(5,30,5), "Mass: 50");
Maybe it's a 1.5 feature (I don't know - never used), but AFAIK (1.0.22) it's not designed to use Ogre::Vector3, but NxOgre::Pose();
I also don't like the string params. IMHO this is a far better way to go:

NxOgre::ActorParams ap;
ap.SetToDefault();
ap.mass = 50;
NxOgre::Body* mBody = mScene->createBody("OgreHead.mesh", new NxOgre::Cube(0.5f), NxOgre::Pose(5,50,5), ap);

No way to make typewrite errors such as "masss: 50"
I also prefer to use the NxOgre::NodeRenderableParameters, but first get the above code running.

Next use your own BodyClasses ( http://nxogre.org/Inheriting_Actor_and_ ... type_class )


NxString myName("MyActorName");
NodeRenderableParams nrp;
nrp.setToDefault();
nrp.mGraphicsModel = "OgreHead.mesh";
nrp.mIdentifier = myName;
nrp.mIdentifierUsage = NxOgre::NodeRenderableParams::IU_Create;
nrp.mMode = NxOgre::RenderableSource::RM_Interpolate;
nrp.mGraphicsModelPose = pose;
// nrp.mGraphicsModelScale = NxVec3(1,1,1);

YourBodyClass* myBody = new YourBodyClass(myName, pose, shape, mScene, nrp, ap);

betajaen

04-03-2009 09:18:58

The Ogre::Quaternion and Ogre::Vector3 can be used instead of a Pose in Bleeding and previous versions, there is a special constructor and operators to handle this.

Check to see if "OgreHead.mesh" actually exists in your media.

TwoFacedWarrior

04-03-2009 16:53:00

i have the same problem.... seems the "error code" is here in Body constructor:

Body::Body(const NxString& identifier, Scene* scene, Shape *firstShapeDescription,
const Pose& pose, const NodeRenderableParams& visualParams, const ActorParams& params)
...
setRenderMode(visualParams.mMode);
mRenderable = mOwner->getSceneRenderer()->createNodeRenderable(visualParams);

// after mOwner->getSceneRenderer() call - we've got mSceneRender
// and its type is NullSceneRenderer, and its createNodeRenderable(NodeRenderableParams) method retuns NULL
// thus we've got mRenderable = NULL
...
}
and later here we've got an exception:
void RenderableSource::render_Absolute(const TimeStep& ts) {
mRenderPose = getSourcePose(ts);
mRenderable->setPose(mRenderPose);
}
'cause mRenderable is still NULL......

may be it's happend 'cause we did't consider this author` warrning enough:
"/** \brief Body is an example of an Actor using a NodeRenderable
\note This is merely an example on how to uses visualisation in NxOgre, it shouldn't
be used for serious things.
*/"
is anybody have suggestions...... i'm a newbie in NxOgre, so sorry if something wrong....

nargil

04-03-2009 17:58:40

My suggestion would be: download cake. Play around with it. It's a good start. Add some bodies into it. Later try implementing NxOgre into your application.

TwoFacedWarrior

05-03-2009 12:43:58

My suggestion would be: download cake. Play around with it. It's a good start. Add some bodies into it. Later try implementing NxOgre into your application.

I've downloaded cake 4.0T1, i've put it in NxOgre 1.0`22 directory and the compile it... and i've got 53 errors.... most of them are so silly like that:

mRenderable = static_cast<OgreNodeRenderable*>(mActor->getVoidPointer()->RenderPtr->getRenderable()); // insted of getUserData()
but some of them i can't solve by just renaming methods, like this:
NxOgre::Raycaster* mRay; i don't know does Raycaster really exists....
and so on....

may you suggest what kind of versions of each Ogre, NxOgre, Cake and PhysX i have to use to have done succesfully compilation...

currently i have, as i mentioned above, NxOgre 1.0`22(from svn, how suggested here http://www.ogre3d.org/wiki/index.php/Nx ... ple_Sample), Cake 4.0T1, PhysX 2.8.1 and OGRE SDK 1.6.1...... is it enough fo succesfull compile, and if yes how to achieve it???
PLEASE HELP!!!

TwoFacedWarrior

05-03-2009 15:56:08

ok.... i've figure out with my problem on the Body creation......
now i see created boxes falling down to the plane, but they fall very slow..... gravity sets to -9.8 and fps is pretty high - around 100.... but the fall like gravity -1.5 not -9.8
earlier when i've integrated PhysX in Ogre the speed of objects on the scene was depend on "value" in NxScene::simulate(value) the acceptable speed was when i set this value to 1........
what should i do in NxOgre app to increase the object` speed?

nargil

05-03-2009 16:47:09


SceneParams sp;
sp.setToDefault();
sp.mController = NxOgre::SceneParams::CN_ACCUMULATOR;
sp.mGravity.set(0,-9.8f,0);
// sp.mSimulationType = NX_SIMULATION_HW;
sp.mUp = 1;
sp.mRenderer = NxOgre::SceneParams::RN_OGRE;
mScene = mWorld->createScene("ScenePhysX", mSceneMgr, sp);

and create a
class physXlistener : public Ogre::FrameListener
{
public:
physXlistener(NxOgre::World* world, NxOgre::Scene* scene) : Ogre::FrameListener()
{
mWorld = world;
mScene = scene;
mPause = false;
}
bool isPaused() const { return mPause; }
void setPause(bool val) { mPause = val; }
protected:
NxOgre::World* mWorld;
NxOgre::Scene* mScene;
bool mPause;
bool frameStarted(const Ogre::FrameEvent& evt)
{
if(!mPause)
{
mWorld->simulate(evt.timeSinceLastFrame);
mWorld->render(evt.timeSinceLastFrame);
}
return true;
}
};

and register it with mRoot->addFrameListener