[Solved]Bug or My Error? PLSM2 & Ogre

XPomJon

18-02-2007 11:46:45

I'm posting this in this and the Ogre Help forum because I'm not sure if the problem is in Ogre or PagingLandScape and whether it's a bug or something that I've done incorrectly ( the last is the most likely.)
I'm using the Ogre Tutorial 3 as a test bed for PLSM2 changing the code as follows:-

protected:
void chooseSceneManager(void)
{
mSceneMgr = mRoot->createSceneManager(ST_EXTERIOR_REAL_FAR);
}

void createScene(void)
{
mSceneMgr->setWorldGeometry( "paginglandscape2.cfg" );
mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 );
}

Running this change results in a crash.
Ogre.log (part)

17:11:51: Added resource location '../../../../paginglandscape/Samples/Media/paginglandscape2/terrains/hf129_3' of type 'FileSystem' to resource group 'PLSM2'
17:11:51: Initialising resource group PLSM2
17:11:51: Texture: clouds.jpg: Loading 1 faces(PF_B8G8R8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
17:11:51: Viewport for camera 'PlayerCam', actual dimensions L: 0 T: 0 W: 1024 H: 722
17:11:51: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: GpuProgramParameters::getParamIndex
Description: Cannot find a parameter named compressionSettings.
File: OgreGpuProgram.cpp
Line: 837
Stack unwinding: <<beginning of stack>>
17:11:51: Unregistering ResourceManager for type BspLevel
17:11:51: *-*-* OGRE Shutdown
17:11:51: Unregistering ResourceManager for type Compositor
17:11:51: Unregistering ResourceManager for type Font
17:11:51: Unregistering ResourceManager for type Skeleton
17:11:51: Unregistering ResourceManager for type Mesh
17:11:51: Unregistering ResourceManager for type HighLevelGpuProgram
17:11:51: Unloading library /usr/local/lib/OGRE/Plugin_PagingLandScape2
17:11:51: Unloading library /usr/local/lib/OGRE/Plugin_OctreeSceneManager
17:11:51: Unloading library /usr/local/lib/OGRE/Plugin_BSPSceneManager
17:11:51: Unloading library /usr/local/lib/OGRE/Plugin_ParticleFX
17:11:51: Render Target 'OGRE Render Window' Average FPS: 0 Best FPS: 0 Worst FPS: 999
17:11:51: Unregistering ResourceManager for type GpuProgram
17:11:51: ******************************
*** Stopping GLX Subsystem ***
******************************
17:11:51: Unregistering ResourceManager for type Texture
17:11:51: Unloading library /usr/local/lib/OGRE/RenderSystem_GL
17:11:51: Unregistering ResourceManager for type Material
17:11:51: Unloading library libOgrePlatform.so

Although the log points to the fault being in OgreGpuProgram.cpp I would have thought that this would have been covered by the functions at lines 1120-1135 in OgrePagingLandScapeRenderable.cpp:-

void PagingLandScapeRenderable::_updateCustomGpuParameter(
const GpuProgramParameters::AutoConstantEntry& constantEntry,
GpuProgramParameters* params) const
{
if (constantEntry.data == MORPH_CUSTOM_PARAM_ID)
{
// Update morph LOD factor
//params->setConstant(constantEntry.index, mLODMorphFactor);
params->setNamedConstant("compressionSettings", mCustomGpuParameters);
}
else
{
Renderable::_updateCustomGpuParameter(constantEntry, params);
}

and at lines 144-161 in OgrePagingLandScapeTexture.cpp:-

void PagingLandScapeTexture::bindCompressionSettings(GpuProgramParametersSharedPtr params)
{
GpuProgramParameters::AutoConstantIterator aci = params->getAutoConstantIterator();
bool found = false;
while (aci.hasMoreElements())
{
const GpuProgramParameters::AutoConstantEntry& ace = aci.getNext();
if (ace.paramType == GpuProgramParameters::ACT_CUSTOM &&
ace.data == MORPH_CUSTOM_PARAM_ID)
{
found = true;
}
}
if (!found)
{
params->setNamedAutoConstant("compressionSettings",
GpuProgramParameters::ACT_CUSTOM, MORPH_CUSTOM_PARAM_ID);
}

I would be grateful for any help, tips or advice to resolve this question.
For information I'm using Linux, Kdevelop to build and run the tutorial. Ogre (version 1.2.5) and paginglandscape were both downloaded from CVS and installed in the same top directory (Ogre/Ogrenew & Ogre/paginglandscape) using the usual ./configure&&make &&make install routine.
Thanks............

Rowan

19-02-2007 08:02:03

Hi, I'm far from an expert on this stuff, but if you're using the example App framework, there's a little more to be done to set up PLSM2 as the Scene Manager.

I advise checking out the PLSM2 Demo for how it's done.

(Assuming that's your problem).

XPomJon

19-02-2007 09:06:48

Hi,
I'll love to be able to try out & explore the Demo but it's only downloadable as a binary for Windows and I'm using Linux. So until the source code is made available that avenue is closed to me.
In the meantime do you have any ideas (in broad terms) what I should do next?
Thanks........

Rowan

20-02-2007 01:35:49

If you downloaded PLSM2 from CVS, then you should have all the code.

The Demo code should be in :: paginglandscape/Samples/PagingLandscape2

It's layout is pretty similar to the Tutes, with chooseSceneManager, createScene, etc...

Before the code though, the first thing to consider is the 'media' arrangements. PLSM2 requires a bit more setup than TSM.

You'll need to add PLSM2 as a plugin, in your plugins (.cfg) script, ie::
Plugin=Plugin_PagingLandScapeSceneManager2
Then in your resources script (resource.cfg), you'll need to add the directories where the PLSM2 required resources are located.

These resources include all the map image files, and their corresponding individual config scripts, plus the main config script: 'paginglandscape2.cfg'.

paginglandscape2.cfg specifies what terrains are available, what they are called, and where they are located.
Each terrain that paginglandscape2.cfg contains then needs to have its own config scrip, eg : 'TsmTerrain.cfg'.

Next, if you haven't done so already, you need to run 'Mapsplitter' on the terrain Heightmap files to generate the [paged] files that PLSM2 operates with. Mapsplitter needs its own config files, similar to PLSM2. Ie: maptool.cfg, is the main one which list which terrains are to be processed, then for each terrain, you need its own '*_gen.cfg' file (eg: TsmTerrain.gen.cfg), which determines how mapsplitter processes each.

Damn, this is getting longer than I thought..! :D

So once the maps have been split, and PLSM2 can find them and their config files, you can fire it up, as per the code in the demo.

I strongly recommend the PLSM2 wiki ::
http://www.ogre3d.org/wiki/index.php/Paging_Scene_Manager
(although it can be a little dated)

And in particular, the config wiki ::
http://www.ogre3d.org/wiki/index.php/Pa ... nfig_files
[ Nb: Tuane has supplied commented 'template' config files for terrains which are good references ].

Hope that clarifies it a bit... lol (there should be plenty of other setup posts around too for more info and in case I got anything wrong.. ;P )

Cheers

XPomJon

21-02-2007 20:45:28

Thanks for the info Rowan. I hadn't realised that the /Samples/PaginglandScape was the demo. I thought that it was another extraneous bit like Mapeditor and IPLandscape. I've now got as far as having an Ogre render window open, blue background but no landscape. Yes, I have run the maps through MapSplitter. I'm using the Alpes map and it looks as if only the base maps are loading. The window closes when I click on it with the message

PagingLandScape2: ../../../PlugIns/PagingLandScape2/include/OgrePagingLandScapeData2D.h:181: const Ogre::Real Ogre::PagingLandScapeData2D::getHeight(int, int) const: Assertion `mHeightData' failed.
Aborted

I'll persevere and let you know how I get on.

XPomJon

22-02-2007 01:35:57

All working now after tweeking some cfg files. It took me some time to realise that the feint white dot in the middle of the blue was in fact the terrain viewed from afar.
I'll try to add something to the wiki either tonight or tomorrow explaining how I got this beast to run on Linux. It maybe of some use to another Newbie.
Thanks again for your help.

XPomJon

22-02-2007 21:23:57

Although I still haven't got paginglandscape to run in my own program yet I have got the demo to run. I written my method for this in the Paging Scene Manager Installation wiki in the hope that it may help other confused Newbies like me.
Perhaps somebody with more experience would like to write a clearer and more elegant method.

Rowan

22-02-2007 22:51:54

Glad to hear you got the demo working, it's a just a bit more fiddling to get it running in your own app (If you get stuck, feel free to post).

Nice work with the wiki, here is a link for anyone who stumbles on this post ::

http://www.ogre3d.org/wiki/index.php/Paging_Scene_Manager_Installation#Linux_Install_2

tuan kuranes

24-02-2007 11:54:54

Can you send me a patch ?

XPomJon

25-02-2007 02:10:39

Can do but how? Do you just want the changed lines or what?. Do I post them here or e-mail them directly to you?

tuan kuranes

28-02-2007 15:04:24

http://www.ogre3d.org/index.php?option= ... &Itemid=87
Once the patch is created you can send me the file (email).

XPomJon

01-03-2007 01:10:30

Done. And that's something else that I've learnt how to do. Thanks Tuan. I'll alter the wiki in a day or so to reflect this change.