Problem loading mesh with RessourceSystem

hotdot

10-11-2008 23:31:04

Here is my code :



void OfusionCallBack::OnEntityCreate(Ogre::Entity *pEntity, TiXmlElement* pEntityDesc)
{
try
{
NxOgre::Scene* physXScenePtr = OddBoyGame::getSingleton().getPhysxScene();
NxOgre::World* physXWorldPtr = OddBoyGame::getSingleton().getPhysxWorld();

Ogre::ResourcePtr rPtr = pEntity->getMesh()->getCreator()->getByName(pEntity->getMesh()->getName());

String meshFileName = "file://../Resources/TerrainExport/";
meshFileName += pEntity->getMesh()->getName();

NxOgre::Resources::ResourceSystem* rsPtr = NxOgre::Resources::ResourceSystem::getSingleton();

rsPtr->addMeshAs(meshFileName.c_str(), pEntity->getMesh()->getName().c_str());

NxOgre::Resources::Mesh* collisionMesh = rsPtr->getMesh(pEntity->getMesh()->getName().c_str());

physXScenePtr->createActor(pEntity->getName(), new NxOgre::TriangleMesh(collisionMesh), pEntity->getParentSceneNode()->getPosition() , "static: yes");
}
catch(...)
{}
}


The log has an entry for each model loaded in my oScene, it says that it is already loaded, so i figure it must find it at some level (ofusion has loaded the mesh already).

The thing is it crashes on createActor

stack :


PhysXCore.dll!041e8e46()
[Frames below may be incorrect and/or missing, no symbols loaded for PhysXCore.dll]
> msvcr80d.dll!_heap_alloc_dbg(unsigned int nSize=87923268, int nBlockUse=1304124, const char * szFileName=0x053d9c58, int nLine=1303448) Line 474 + 0xc bytes C++
PhysXCore.dll!041eafa1()
NxOgre_d.dll!NxOgre::UserAllocator::malloc(unsigned int size=69204263) Line 62 + 0x10 bytes C++
PhysXCore.dll!041ff8d9()
PhysXCore.dll!042285a3()
NxOgre_d.dll!Betajaen::SharedList<NxOgre::Shape,Betajaen::SharedAllocator>::Insert(NxOgre::Shape * const & val=0x0095aa98) Line 569 + 0x10 bytes C++
NxOgre_d.dll!NxOgre::Actor::Actor(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name="Object01", NxOgre::Scene * scene=0x01394420, NxOgre::Shape * shape=0x053d9970, const NxOgre::Pose & pose={...}, const NxOgre::ActorParams & params={...}) Line 237 C++
NxOgre_d.dll!NxOgre::Scene::createActor(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & identifier="Object01", NxOgre::Shape * firstShapeDescription=0x053d9970, const NxOgre::Pose & pose={...}, const NxOgre::ActorParams & params={...}) Line 833 + 0x3f bytes C++
OddBoy.exe!Game::OddBoyOfusionCallBack::OnEntityCreate(Ogre::Entity * pEntity=0x053d9078, TiXmlElement * pEntityDesc=0x0549ea40) Line 33 + 0x166 bytes C++
OddBoy.exe!OSMScene::createEntities(TiXmlElement * pEntityNode=0x0549e958, Ogre::SceneNode * pSceneRoot=0x013bd9e8) Line 735 + 0x1d bytes C++
OddBoy.exe!OSMScene::createScene(Ogre::SceneNode * pParent=0x013bd9e8) Line 200 C++
OddBoy.exe!Game::GameState_Start::enter(OGE::IStateMachine<Game::OddBoyGame> * sm=0x013b90b8, Game::OddBoyGame * object=0x0130ba80) Line 35 C++
OddBoy.exe!OGE::GameStateMachine<Game::OddBoyGame>::changeState(OGE::IState<Game::OddBoyGame> * newState=0x0537fc60) Line 121 + 0x3f bytes C++
OddBoy.exe!Game::OddBoyGame::HighPriorityInitialization() Line 113 + 0x26 bytes C++
OGameEngine.dll!OGE::OgreAppInterface::StartApplication(OGE::GameInterface * gameObject=0x0130ba80) Line 52 + 0x17 bytes C++
OddBoy.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00161f28, HINSTANCE__ * __formal=0x00000000) Line 58 + 0x27 bytes C++



It tries to malloc in nx..allocator.h some 69204263 at line 61. I have huge .mesh which we use for testing terrain loading, and we do not use height maps because they are made in max by the artists for control purpose. What could go wrong since it crashes on the first loaded item.

betajaen

10-11-2008 23:42:02

Your loading an Ogre mesh into PhysX. It needs to be a NXS mesh. Have a look at flour.

hotdot

11-11-2008 20:30:24

I flour'ed all my .mesh, its still crashing at the same place. btw i am not sure if i have to absolutely get the latest version from svn. Also i am not sure if this is the best way to load individual mesh as tutorials are rather rare material here. Also as a side comment i had to compile flour manually since the installer version was annoyingly saying "what" to whatever i was saying. I am finding that nxogre has such a big step to use its getting to a point where i find it a little silly.

Now enough with the ranting, we want to use this in our game, we are a commercial studio and actually would like to get things going, so far we used to have basic body implemented in another demo 6 months back, the api seemed much more settled than it is now, i suggest that you should implement fixes in version change with small numbers (that would be very gentlemen of you) as it would be easier to cope with your api changes.

For my problem i have absolutely no idea how to debug this, i tried to get your demo cooking app, but it seems to not fit in my .21 version and has now templated functions. Could you be as kind enough to fit a release or point me to a place where i can get a snapshot of everything that is supposed to work .21 wise, i tryed to look now but i have the feeling of a dog with three head going in split directions.

Any suggestions before i blow my head out ?

betajaen

11-11-2008 20:54:37

You may be experiencing the "mesh bug error". It's fixed in the "T" versions of NxOgre; You may want to try it out with the latest and see how you get on.

NoodlesOnMyBack

12-11-2008 02:02:28

Like this it works fine for me, with bleeding 1'21 and PhysX 2.8.0.


NxOgre::TriangleMesh* CActor::getTriangle(Ogre::String &param)
{

//Ogre::String meshName = getMeshName(param);
Ogre::String outFile = param;
Ogre::String mpath = "file://../../media/models/" + outFile;

try {
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs(mpath,outFile);
} catch (exception& e) {
Ogre::LogManager::getSingleton().logMessage("||ERROR - addMeshAs() - path:" + mpath + " - outFile: " + outFile);
}

//Ogre::String path = "../../media/models/Penalty/" + meshName + "nxs";
NxOgre::TriangleMesh* _mesh;
try {
_mesh = new NxOgre::TriangleMesh(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh(outFile));
} catch(exception& e) {
//return false;
Ogre::LogManager::getSingleton().logMessage("||ERROR - getMesh() - Triangle mesh. FileName:" + mpath + " - Mesh Name: " + outFile);
}
return _mesh;
}

hotdot

12-11-2008 02:36:31

We have bleeding .21 and physx 2.8.1, maybe its the physx sdk that is the problem here, i had some relatively strange problems regarding cuda.dll and reinstalled my video display drivers as well as the latest physx driver, maybe my 6600 GT has some problems with some dll ?

mcaden

12-11-2008 05:12:17

In 1.0'21 there was a bug in the resourceSystem regarding loading meshes. There's a fix in the first couple pages of the bleeding thread. I'm busy at the moment but I believe there were several people taking care of it. If I remember right you can look for Cephalor's and Gugus' posts in the first 1-3 pages of the thread.

reptor

12-11-2008 11:56:35

The system software 8.09.04 installer has a bug, that's why you get a "nvcuda.dll" error. Check topic "ATI incompatible?" here for more info.

http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=8423

I don't know if it has any effect on your problem discussed on this topic.

NoodlesOnMyBack

12-11-2008 12:29:23

Hey hotdog, i have almost the same specs as you, but i had to change the NxOgre code with the modification from the "mesh bug" thread.
Or you are not loading the resources (addMeshAs) with the correct path? I also have an Nvidia 6600GT and 1'21 working fine here

hotdot

12-11-2008 21:20:51

The loading problem has been corrected in the .22T5 version that i am using now. Thanks for your magnificient help :)