problem with basic tutorial 3 , exception6

DProphet

28-10-2010 19:09:48

Hi i've got a little problem. And i can't find solution :(
When i writed this code:


protected override void ChooseSceneManager()
{
mSceneMgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE);
// mSceneMgr.SetWorldGeometry("terrain.cfg");
mSceneMgr.SetWorldGeometry("terrain.cfg");
mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox");
}




i've got exception(it cannot locate terrain.cfg at first)
when i copied terrain.cfg to bin directory i've got exception like this


OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource terrain.png in resource group General or any other group. in ResourceGroupManager::openResource at ..\..\ogre\OgreMain\src\OgreResourceGroupManager.cpp (line 753)




I didn't change resource.cfg. Everything is ther where i unpack tutorial pack.

It's strange because program is finding ninja without any problem.

Any idea?


It works !

mSceneMgr.SetWorldGeometry("terrain.cfg");
should be in

CrateScene


also skybox.
I also change some options in ogre setup window , like vsync on :D

Beauty

29-11-2010 01:25:08

I also had this problem.
After a half hour of search (and embedding the source code of the TutorialFramework) I found the exception source.
Now I wanted to report this bug similar issue and found this post.

The problem source:
The method ChooseSceneManager() will be called before the resources are loaded (inside of the TutorialFramework).

My proposal:
Edit the source code of the TutorialFramework and move the resource loading methods up.
Look here here:

protected virtual bool Setup()
{
mRoot = new Root(mPluginsCfg);

if (!Configure())
return false;

CreateResourceListener(); // NEW POSITION
LoadResources(); // NEW POSITION

ChooseSceneManager();
CreateCamera();
CreateViewports();

TextureManager.Singleton.DefaultNumMipmaps = 5;

//CreateResourceListener(); // OLD POSITION
//LoadResources(); // OLD POSITION

CreateScene();

CreateFrameListeners();
InitializeInput();

mDebugOverlay = new DebugOverlay(mWindow);
mDebugOverlay.AdditionalInfo = "Bilinear";

return true;
}


This prevents trouble. (This happens also to me, although I use Mogre for 3 years now.)
I checked this modification and it works.

Additionally I modified the Mogre Basic Tutorial 3 wiki page:
* Marked up the method name CreateScene(). (I didn't see it before, because it was so inconspicuously.)
* Added a note that the user shouldn't add it to ChooseSceneManager().


P.S.
DProphet, welcome to the Mogre world (-:
By the way - if you want to reply to your own question, it would be better to reply by an additional post. This is better for the overview :wink:

amirabiri

27-12-2010 10:18:08

Thank you for your feedback!

I've slightly modified the note on the wiki page but the warning is still there, so hopefully if anyone else steps on this mine in the future they would spend much less time trying to figure out the problem.

Regarding changing the code, I'm just a little worried that changing the sequence of events at this point might introduce an error to some of the existing tutorials. I need to get my head back into the code (I've managed to forget!) and then I'll have the confidence to make the change and hopefully the time to test the tutorials.

(If anyone has some time and would like to help, you could apply the change above and then run through a tutorial or two to make sure they still work - that would be much appreciated).