[SOLVED] Updating to most recent PLSM

CaseyB

23-03-2006 17:05:54

Updating to 1.2RC1 broke my PagingLandscape app and I am having a heck of a time getting it working again! Has anyone else had this trouble? I am getting all kinds of asserts from inside the paginglandscape.dll! :?

tuan kuranes

23-03-2006 20:44:23

Updating to 1.2RC1 broke my PagingLandscape app and I am having a heck of a time getting it working again! Has anyone else had this trouble?

did you update ogre sdk only or plsm2 sdk only or both ?

am getting all kinds of asserts from inside the paginglandscape.dll
what kind ?

CaseyB

23-03-2006 20:55:40

Yeah, sorry about the vagueness! :oops:
I downloaded the release version of the Ogre source, built it and ported one of our apps over to it. Then I tried to port the app that uses the PLSM. I tried to rebuild the PLSM against the new Ogre, but I ran into a lot of error, so I downloaded the newest version from CVS. That built against the new Ogre without any trouble. I tried to port the app over and I ran into a lot of issues so I decided to do it right! (We had just hacked it together to make it work!) So I started over using some new classes that we made and cleaned up a lot of crap. Now the assert I am getting happens when I callResourceGroupManager::getSingleton().initialiseAllResourceGroups(); and it looks like this

When I trace it down into Ogre it dies hereGpuProgramManager& GpuProgramManager::getSingleton(void)
{
assert( ms_Singleton ); return ( *ms_Singleton );
}
in ogregpuprogrammanager.cpp after being called in the bool CgProgram::isSupported(void) method.

tuan kuranes

23-03-2006 21:29:44

Only time I have those sort of problem is DLL inconsistency.
Double check there is no older DLL (all dll listed in plugins.cfg must be up to date with ogremain.dll), rebuild all...

CaseyB

24-03-2006 16:32:50

Ok, last night I updated Ogre from CVS and the PLSM from CVS and rebuilt both of them, then I made sure that I was linking in the newest libs, (I double checked and I only have one set on this box) and rebuilt my app, copied the newly created dll's into the executable directory and I get the same issue?! :? It's the GpuProgramManager::getSingleton() that fails. Aparently there is no instance of the GpuProgramManager! Is there something I am doing wrong in code that could cause this? Here is the code for my main class so you can see how I initialize everything.
OgreApp::OgreApp()
{
root = new Root;
// Load resource paths from config file
ConfigFile cf;
cf.load("resources.cfg");

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

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

// Initialise, parse scripts etc
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
root->showConfigDialog(); // This asks the user
win = root->initialise(true, "Ogre Framework");

sceneMgr = root->createSceneManager("PagingLandScapeSceneManager", "MainSceneManager");
sceneMgr->setWorldGeometry("terrain.cfg");

camera = sceneMgr->createCamera("SimpleCamera");

viewPort = root->getAutoCreatedWindow()->addViewport(camera);
viewPort->setBackgroundColour(ColourValue(0,0,0));
camera->setAspectRatio(Real(viewPort->getActualWidth()) / Real(viewPort->getActualHeight()));
camera->setNearClipDistance(1.0);

createScene();

listener = new DeviceListener(win, camera, sceneMgr,mainActor);

root->addFrameListener(listener);
}

OgreApp::~OgreApp()
{
delete listener;
delete mainActor;
delete root;
}

void OgreApp::start()
{
root->startRendering(); // will not continue until a frame listener returns false.
// eg from pressing escape in this example
}

void OgreApp::createScene()
{
// Create a Sky Dome
sceneMgr->setSkyDome(true, "Sky", 5, 8, 4000, true);
// Setup the ambient light
sceneMgr->setAmbientLight(ColourValue(0.5f, 0.5f, 0.5f));
// Setup Shadows
sceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_MODULATIVE);

mainActor = new MainActor(camera, true, "DC10.mesh", "MainActor", Vector3::ZERO, Vector3(0, 500, 1000), 1.0f);
mainActor->setPosition(Vector3(0, 150, 300));

light = sceneMgr->createLight("sun");
light->setType(Light::LT_DIRECTIONAL);
light->setDirection(-1,-1,-1);

// Set up Overlay
// get the font manager
FontManager &fontMgr = FontManager::getSingleton();
// create a font resource
ResourcePtr font = fontMgr.create("MyFont","General");
// set as truetype
font->setParameter("type","truetype");
// set the .ttf file name
font->setParameter("source", "ARIAL.TTF");
// set the size
font->setParameter("size","16");
// set the dpi
font->setParameter("resolution","96");
// load the ttf
font->load();

// get the overlay manager
OverlayManager& overlayMgr = OverlayManager::getSingleton();

// Create a panel
Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(
overlayMgr.createOverlayElement("Panel", "PanelName"));
panel->setMetricsMode(Ogre::GMM_PIXELS);
panel->setPosition(10, 10);
panel->setDimensions(100, 100);

// Create a text area
TextAreaOverlayElement* textArea = static_cast<TextAreaOverlayElement*>(
overlayMgr.createOverlayElement("TextArea", "TextAreaName"));
textArea->setMetricsMode(Ogre::GMM_PIXELS);
textArea->setPosition(0, 0);
textArea->setDimensions(100, 100);
textArea->setCharHeight(16);
// set the font name to the font resource that you just created.
textArea->setFontName("MyFont");
// say something
textArea->setCaption("Hello, World!");

// Create an overlay, and add the panel
Ogre::Overlay* overlay = overlayMgr.create("AverageFps");
overlay->add2D(panel);

// Add the text area to the panel
panel->addChild(textArea);

// Show the overlay
overlay->show();
}

tuan kuranes

24-03-2006 16:39:50

Code seems ok.
Perhaps a plugin load order, does plugin_cgprogrammanager is loaded before scene manager plugins ?
Make sure you removed ogre.cfg too as format as changed.

CaseyB

24-03-2006 17:27:35

Here is my plugins.cfg:

# Defines plugins to load

# Define plugin folder
PluginFolder=.

# Define plugins
Plugin=RenderSystem_Direct3D9
Plugin=RenderSystem_GL
Plugin=Plugin_CgProgramManager
Plugin=Plugin_PagingLandScapeSceneManager2_d

Make sure you removed ogre.cfg too as format as changed.
What do you mean by this? Remove it from where?

CaseyB

24-03-2006 19:15:45

Ok, I put a break point inside of the constructor of Ogre::Singleton and as I step through it is being called by the following classes:
  1. Ogre::Root
    Ogre::LogManager
    Ogre::DynLibManager
    Ogre::ArchiveManager
    Ogre::ResourceGroupManager
    Ogre::ResourceBackgroundQueue
    Ogre::SceneManagerEnumerator
    Ogre::MaterialManager
    Ogre::MeshManager
    Ogre::SkeletonManager
    Ogre::ParticleSystemManager
    Ogre::PlatformManager
    Ogre::OverlayManager
    Ogre::FontManager
    Ogre::HighLevelGpuProgramManager
    Ogre::ExternalTextureSourceManager
    Ogre::CompositorManager
    Ogre::GLSLLinkProgramManager[/list:u]
    Ogre::GpuProgramManager extends Ogre::Singleton but the Singleton constructor is never called by that class so it seems that the Ogre::GpuProgramManager is never being created. Why may this be?

tuan kuranes

24-03-2006 19:34:46

What do you mean by this? Remove it from where?
delete the file so that Ogre creates a new one.

well, as nothing is wrong in code nor in Ogre, it still looks like a dll problem...

Make sure using depends.exe (given with vc++ or downloadable on the web) it's ok. can be exe not being updated, wrong lib, etc... try moving exe app into ogre common/bin/debug folder, etc...

CaseyB

24-03-2006 21:38:56

I opened it in the dependancy walker, but I don't really know what I'm looking for. The olny Ogre-based dll's that showed up were the DevIL dll's and OgreMain. The OgreMain.dll was the one I thought I was pointing to and was created yesterday. When I put the executable in the ogrenew/samples/common/bin directory it still dies, but this time it throws an unhandled exception at RenderSystemCapabilities* getCapabilities(void) const { return mCapabilities; } in OgreRenderSystem.h. Also I deleted the ogre.cfg file, but the app doesn't run long enough to create a new one.

tuan kuranes

25-03-2006 09:44:46

If you double check the dll... did you double check the Exe ?
(rebuild it if needed and check date)

Otherwise, have no idea...

CaseyB

25-03-2006 15:11:00

:? Ok, Thanks for the help! I really feel that it's something stupid that I'm doing! I'll keep hunting it down when I get back inthe office on Monday and I'll let you know if I find anything.

CaseyB

27-03-2006 19:31:53

Ok, I tracked most of the issues down. They were issues with the order I was doing things in, but now I have this error.
-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: TextAreaOverlayElement::setFontName
Description: Could not find font BlueHighway.
File: c:\development\ogrenew\ogremain\src\ogretextareaoverlayelement.cpp
Line: 337
Stack unwinding: <<beginning of stack>>
13:13:57: An exception has been thrown!

And I can't figure out why it's even looking for that font!

CaseyB

27-03-2006 23:31:45

Alright! I got it working now, that last issue was that I had left the line in the resources.cfg file that pointed to the overlays! Thank you for all your help!