Diabolikal49
20-01-2011 20:11:54
I'm using Detritus and Critter at the moment and my program crashes when it attempts to create a world, or possibly when it attempts to allocate the memory for the world object.
My C++ is simply taken from the 101 Critter tutorial (I have edited out the unapplicable code):
.h
#include "NxOgre.h"
#include "critter.h"
NxOgre::World* mWorld;
NxOgre::Scene* mScene;
float mLastTimeStep;
NxOgre::Material* mDefaultMaterial;
Critter::RenderSystem* mRenderSystem;
Critter::Body* mBody;
.cpp
void Snoogre120111::setupPhysics(void)
{
// Create the world.
mWorld = NxOgre::World::createWorld(); //CRASHES HERE.
mWorld->getRemoteDebugger()->connect();
// Create the scene
NxOgre::SceneDescription scene_description;
scene_description.mGravity = NxOgre::Constants::MEAN_EARTH_GRAVITY;
scene_description.mUseHardware = false;
mScene = mWorld->createScene(scene_description);
// Set default material properties
mDefaultMaterial = mScene->getMaterial(0);
mDefaultMaterial->setRestitution(0.1f);
mDefaultMaterial->setDynamicFriction(0.9);
mDefaultMaterial->setStaticFriction(0.5);
// Plane creation
mScene->createSceneGeometry(NxOgre::PlaneGeometryDescription());
// Create the rendersystem.
mRenderSystem = new Critter::RenderSystem(mScene, mSceneMgr);
// mRenderSystem->setVisualisationMode(NxOgre::Enums::VisualDebugger_ShowAll);
// Setup a BodyDescription.
Critter::BodyDescription bodyDescription;
bodyDescription.mMass = 40.0f; // Set the mass to 40kg.
// Finally create the body.
mBody = mRenderSystem->createBody(NxOgre::BoxDescription(1,1,1), NxOgre::Vec3(0,5,0), "cube.1m.mesh", bodyDescription);
}
bool Snoogre120111::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
// Advance NxOgre.
mWorld->advance(evt.timeSinceLastFrame);
mLastTimeStep = mScene->getTimeStep().getModified();
}
I'm not sure if I am missing something, but the result when I run my program is an unhandled exception when it hits this line in dbgheap.c:
/* do the allocation
*/
pvBlk = _heap_alloc_dbg_impl(nSize, nBlockUse, szFileName, nLine, errno_tmp);
I wonder if anybody has experienced this before, and/or knows the solution to this issue?
Thanks for your time,
Jamie
betajaen
20-01-2011 20:19:37
That is odd. Your the second one to have a heap allocation problem with Detritus. I've used Detritus recently and had not this problem. Is there any chance you can trace the problem to the causing line in NxOgre?
Diabolikal49
20-01-2011 21:29:55
In NxOgreWorld, where it tries to create a new ErrorStream:
if (ErrorStream::getSingleton() == 0)
{
NxOgre_DebugPrint_Core("World::precreateSingletons -- Creating ErrorStream");
GC::safe_new0<ErrorStream>(NXOGRE_GC_THIS);
}
It crashes due to GC::safe_new0<ErrorStream>(NXOGRE_GC_THIS);.
I also noticed something weird in my output, why would it be unable to find the program database file?:
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Snoogre12-01-11.exe', Symbols loaded.
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\OgreMain_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\OIS_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\dinput8.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\NxOgreDebug.dll', Symbols loaded.
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\PhysXLoader.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\winnsi.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\OgreTerrain_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\OgrePaging_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\RenderSystem_Direct3D9_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\d3d8thk.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\D3DX9_42.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\nvd3dum.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\RenderSystem_GL_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x8d4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xcfc) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x13d8) has exited with code 0 (0x0).
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Plugin_ParticleFX_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Plugin_BSPSceneManager_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Plugin_CgProgramManager_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\cg.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Plugin_PCZSceneManager_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Plugin_OctreeZone_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\Plugin_OctreeSceneManager_d.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Users\Jay\Desktop\OgreSDK_vc10_v1-7-1\bin\debug\PhysXCooking.dll', Cannot find or open the PDB file
'Snoogre12-01-11.exe': Loaded 'C:\Windows\SysWOW64\wsock32.dll', Cannot find or open the PDB file
First-chance exception at 0x7532b727 in Snoogre12-01-11.exe: Microsoft C++ exception: NxOgre::PhysXSystemSoftwareException at memory location 0x0030ecb4..
Unhandled exception at 0x7532b727 in Snoogre12-01-11.exe: Microsoft C++ exception: NxOgre::PhysXSystemSoftwareException at memory location 0x0030ecb4..
Could this have something to do with it?
deshan
21-01-2011 03:34:43
mWorld = NxOgre::World::createWorld(); //CRASHES HERE.
the same thing happened for me when I was ported the sdk to 2.8.x
After I copied all Physx..... dll to same directory it worked fine.
betajaen
21-01-2011 08:15:46
That is strange though. I don't know why it's causing an heap error. In BuggySwires if the dlls aren't installed, it gracefully exits with a helpful message.
Diabolikal49
21-01-2011 18:28:28
Would you suggest switching to BuggySwires then Betajaen? I'm new to NxOgre, but not to programming in general.
betajaen
21-01-2011 19:33:02
I'd stick with Detritus for now. Did you try out what Deshan suggested?
Diabolikal49
21-01-2011 21:14:55
I copied
all of the PhysX dlls from the SDK/bin to my OgreSDK/bin folder, and my program now loads successfully. Well done deshan, and thanks for the help
Changed thread to solved.
betajaen
21-01-2011 21:27:28
I'll try and track down the source of the heap error though. Comparing the ErrorStream files between Detritus and BuggySwires would be a good start.