PLSM2 Without the ExampleFramework

Fanatic

07-04-2006 05:11:13

I'm trying to get an app running without using the example framework and using PLSM2.

I have the following code:

Root * pRoot = new Root ();

pRoot -> showConfigDialog (); // ogre init failed

ConfigFile cFile;
cFile.load ("resources.cfg");

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

String secName, typeName, archName;
while (seci.hasMoreElements ())
{
secName = seci.peekNextKey ();
ConfigFile::SettingsMultiMap * pSettings = seci.getNext ();
ConfigFile::SettingsMultiMap::iterator i;
for (i = pSettings -> begin (); i != pSettings -> end (); ++i)
{
typeName = i -> first;
archName = i -> second;
ResourceGroupManager::getSingleton ().addResourceLocation (archName, typeName, secName);
}
}

RenderWindow * pWindow = pRoot -> initialise (true);

SceneManager * pSceneManager = pRoot -> createSceneManager (ST_EXTERIOR_REAL_FAR);
pSceneManager -> setWorldGeometry ("paginglandscape2.cfg");

Camera * pCamera = pSceneManager -> createCamera ("PlayerCam");
pCamera -> setPosition (Vector3 (0, 0, 500));
pCamera -> lookAt (Vector3 (0, 0, -300));
pCamera -> setNearClipDistance (5);
pCamera -> setFarClipDistance (0);

Viewport * pViewport = pWindow -> addViewport (pCamera);
pViewport -> setBackgroundColour (ColourValue (0, 0, 0));
pCamera -> setAspectRatio (Real (pViewport -> getActualWidth ()) / Real (pViewport -> getActualHeight ()));

pRoot -> startRendering ();


Upon calling startRendering I'm getting an assertion in ogresharedptr.h (line 93).

If I switch to ST_GENERIC (and comment out setWorldGeometry) I get a blank black screen as expected.

Is there something else that must be done before PLSM2 to render? My cfg files *should* (assuming I've done them right) be pointing to the alpes landscape from the demo.

Note I do not have a framelistener set up yet, nor any lighting, loading of meshes, etc.

tuan kuranes

07-04-2006 07:55:21

if this is Ogre SDK 1.2rc1 "createscenemanager" may not suffice, if your plugins.cfg still include plugin_octreescenemanager.

try something like


SceneManager * pSceneManager = pRoot ->createSceneManager("PagingLandScapeSceneManager", "Gen_Manager" );


ps: please enclose you code into bbcode tags

Fanatic

07-04-2006 09:01:42

Yes, this is with 1.2rc1.

I tried changing the create scene manager to match what you have below but still get the same assertion.

The cfg files have been unmodified from what comes with the sdk except to add the PLSM2 required entries.


# Defines plugins to load

# Define plugin folder
PluginFolder=.

# Define plugins
Plugin=RenderSystem_Direct3D9
Plugin=RenderSystem_GL
Plugin=Plugin_ParticleFX
Plugin=Plugin_BSPSceneManager
Plugin=Plugin_OctreeSceneManager
Plugin=Plugin_CgProgramManager
Plugin=Plugin_PagingLandScapeSceneManager2_d


I can copy the other cfg's if needed.

I tried commenting out the octreescenemanager as well, but it did not make any difference.

(Fixed the code in my original post for bbcode tags).

tuan kuranes

07-04-2006 10:24:37

add
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups ();

just before createSceneManager and you're done.

Fanatic

08-04-2006 07:55:02

That resolved the issue. Thanks.