mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Gamewriter
Gnoblar
Posts: 3
Joined: Fri Jul 26, 2013 7:39 pm

mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Post by Gamewriter »

Regarding this line in Mogre Basic Tutorial 3:
mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Everything worked fine until I added that code. Then running the program would only display a black screen and display this error:

SEHExeption was unhandled by user code
External component has thrown an exception. (This was mogre.dll)

Setting the first parameter to false returns to normal (displaying the terrain).


Ogre.log displays this:
19:47:05: OGRE EXCEPTION(2:InvalidParametersException): Sky box material 'Examples/SpaceSkyBox' not found. in SceneManager::setSkyBox at ..\..\ogre\OgreMain\src\OgreSceneManager.cpp (line 1714)

But I have the material script, and skybox.zip. I tried extracting the zip file...no joy.

I've tried adding this first in Main, then CreateScene, and then at the beginning to ChooseSceneManager to no avail:
var resourceGroupMgr = new ResourceGroupManager();
resourceGroupMgr.InitialiseAllResourceGroups();
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Post by Kojack »

Gamewriter wrote:I've tried adding this first in Main, then CreateScene, and then at the beginning to ChooseSceneManager to no avail:
var resourceGroupMgr = new ResourceGroupManager();
resourceGroupMgr.InitialiseAllResourceGroups();
You shouldn't create a resourcegroupmanager manually, ogre's root creates one.
InitialiseAllResourceGroups should only be called after all paths have been added.

How is your code adding resource paths? Is it using a resource.cfg loader or just manually adding paths in code?
Gamewriter
Gnoblar
Posts: 3
Joined: Fri Jul 26, 2013 7:39 pm

Re: mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Post by Gamewriter »

There is a resources.cfg file which contains this:
# Resource locations to be added to the 'boostrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=../../Media/packs/OgreCore.zip

# Resource locations to be added to the default path
[General]
FileSystem=../../Media
FileSystem=../../Media/fonts
FileSystem=../../Media/materials/programs
FileSystem=../../Media/materials/scripts
FileSystem=../../Media/materials/textures
FileSystem=../../Media/models
Zip=../../Media/packs/cubemap.zip
Zip=../../Media/packs/skybox.zip
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Post by Kojack »

Are you then doing something like this in your code?
(This is C++, the Mogre version will be similar)

Code: Select all

	Ogre::ConfigFile cf;
	cf.load("resources.cfg");

	// Go through all sections & settings in the file
	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();

	Ogre::String secName;
	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		for (Ogre::ConfigFile::SettingsMultiMap::iterator i = settings->begin(); i != settings->end(); ++i)
		{
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(i->second, i->first, secName,false,i->second.find("zip")!=std::string::npos);
		}
	}

	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre doesn't understand the resources.cfg file, you need to provide the code yourself to load it.
Gamewriter
Gnoblar
Posts: 3
Joined: Fri Jul 26, 2013 7:39 pm

Re: mSceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox")

Post by Gamewriter »

No, nothing like that. I'm just using the Mogre Wiki Tutorial Framework and the code at http://www.ogre3d.org/tikiwiki/tiki-ind ... Tutorial+3

My only reference to any cfg file is this line:
mSceneMgr.SetWorldGeometry("terrain.cfg");

I assume that this line in Main is supposed to set everything up:
new Tutorial().Go();
Post Reply