[SOLVED] Runtime Error with Tutorials

winston2020

02-09-2008 19:50:04

Hi all, I'm working with this tutorial: http://www.ogre3d.org/wiki/index.php/NxOgre_Tutorial_Simple_Sample

Everything works in debug, and compiles in release, but when I start the app, I get an assertion error. It says "Expression: ms_Singleton".

Any ideas what may be the culprit?

Also, I'm very new (few weeks) to C++, I'm assuming that running the app in release will improve speed. Is that correct? I'm currently only getting 4 FPS on a simulation with 1000 cubes in a cube-grid pattern.

EDIT: The source of the error is ogreroot.cpp

EDIT 2: Turns out I forgot to change plugins.cfg to release :oops: :oops:

mcaden

02-09-2008 19:58:51

I believe that's usually something related to Root being used before it's created, but I don't know why it'd work in debug, but not release.

Yes, release should be at a good FPS. I get 6-12 in debug on my game, and I can get 200+ in release. Debug causes a LOT of extra physics overhead.





EDIT: make sure you remove or comment out
mNxScene->createActor(new Terrain(
which exists at the bottom of the tutorial. I don't know why he stopped at that point. I've commented it out on the wiki.

winston2020

02-09-2008 20:20:42

I believe that's usually something related to Root being used before it's created, but I don't know why it'd work in debug, but not release.


I'm using the example framework, so Root is create automatically.


Yes, release should be at a good FPS. I get 6-12 in debug on my game, and I can get 200+ in release. Debug causes a LOT of extra physics overhead.


Thanks :D. I thought I had read that somewhere but wasn't sure.


EDIT: make sure you remove or comment out
mNxScene->createActor(new Terrain(
which exists at the bottom of the tutorial. I don't know why he stopped at that point. I've commented it out on the wiki.

Yup, I did that. Although it wouldn't compile if I hadn't removed that line.
Thanks for the reply, but the problem persists. Any other ideas?

winston2020

02-09-2008 21:00:59

I think I've located the problem. I used the VC++ debugger to check how far the app gets before crashing. Turns out it never makes it past this line:

mRoot = new Ogre::Root(pluginsPath,
mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");


I checked the values of pluginsPath and mResourcePath at runtime.
In debug mode:
pluginsPath = "plugins.cfg"
mResourcePath = ""

However, in release mode, mResourcePath is filled with garbage. So, I thought to myself "well, that's an easy fix", and added this line:


mResourcePath = "";


Which seems easy enough. Nope. As soon as that line is finished, the value is back to garbage.

At least I've narrowed down the issue now.

winston2020

02-09-2008 23:35:05

Looked into it more, apparently none of the apps I've made using ExampleApplication work properly in release.

Does anyone have any ideas at all?

mcaden

03-09-2008 03:00:46

I believe that's usually something related to Root being used before it's created, but I don't know why it'd work in debug, but not release.

Sorry, I was tired when I wrote this so it wasn't very clear. The 'but' meant it couldn't really be the problem because in debug it was running just fine.

Glad your prob got fixed.