Can't find Core/DebugOverlay

SuperElectric

02-02-2006 07:53:20

I'm writing my first pyogre app, drawing what I ndeed from SampleFramework.Application. For the moment, I'm using SampleFramework.FrameListener as-is, but my code barfs when it tries to show the frame-per-second overlay:

Viewport for camera 'RunnViewerCamera', actual dimensions L: 0 T: 0 W: 800 H: 600
Traceback (most recent call last):
File "runn.py", line 447, in ?
rmain = RunnMain()
File "runn.py", line 410, in __init__
self.rviewer = RunnViewer(self.rworld)
File "runn.py", line 47, in __init__
self.frameListener = FrameListener(self.renderWindow, self.camera)
File "runn.py", line 160, in __init__
self.showDebugOverlay(True)
File "runn.py", line 203, in showDebugOverlay
raise ogre.Exception(111, "Could not find overlay Core/DebugOverlay", "SampleFramework.py")
File "/usr/lib/python2.4/site-packages/pyogre/ogre.py", line 143, in __init__
_swig_setattr(self, Exception, 'this', _ogre.new_Exception(*args))
NotImplementedError: No matching function for overloaded 'new_Exception'
*-*-* OGRE Shutdown

I can't find anywhere in SampleFramework.py where it looks like an overlay by the name of "Core/DebugOverlay" is created. Is it some built-in thing? In which case, why can't my code find it? Also, are ogre Exceptions not swigged yet, or is this a problem local to my installation?

Stuff I did that might be bad:
  1. * The media folder is at ./media relative to the source code, not ../media. I've changed the entries in resources.cfg to reflect this.
    * resources.cfg and plugins.cfg are in the directory ./settings relative to the source code. The code specifies them by relative path, and they seem to be loading.[/list:u]
    Even if somebody could just point me to where the "Core/DebugOverlay" is named and registered with the OverlayManager, that'd be a big help.

    Thanks,
    -- Matt

dermont

02-02-2006 08:34:05

It should be in the media/packs/OgreCore.zip archive, in the "OgreDebugPanel.overlay" script.

Your resources.cfg file should begin with something like this, eg:

[Bootstrap]
Zip=../media/packs/OgreCore.zip

# Resource locations to be added to the default path
[General]
.
.


For usage check def showDebugOverlay in SampleFrameWork.py->FrameListener.

griminventions

02-02-2006 13:55:03

Overlay scripts are read in at startup as resource files, then you reference them by name to use them. So there's no explicit creation.

SuperElectric

02-02-2006 22:12:56

Hmm; the overlay stuff is indeed in OgreCore.zip, as you say. I suspect that I'm running into trouble because my directory structure is slightly different from the demo code. Here it is:

rootDir/
runn.py
media/
(...)
settings/plugins.cfg
resources.cfg


The file "runn.py" has all the code. The code that reads in the .cfg files is as follows:
# read plugins.cfg
self.ogreRoot = ogre.Root('settings/plugins.cfg')#ogre.getPluginPath())

# read resources.cfg
config = ogre.ConfigFile()
config.loadFromFile('settings/resources.cfg')
for section, key, path in config.values:
ogre.ResourceGroupManager.getSingleton().addResourceLocation(path, key, section)

When starting up, the code above spews alot of messages along the lines of
Added resource location './media/packs/OgreCore.zip' of type 'Zip' to resource group 'Bootstrap'

... but I guess that doesn't necessarily mean that it actually found those paths.

I edited resources.cfg to refelct the new relative postion of the media folder (i.e. I replaced references to ../media/ with ./media):

[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
FileSystem=./media/overlays
FileSystem=./media/particle
#FileSystem=./media/gui
Zip=./media/packs/cubemap.zip
Zip=./media/packs/cubemapsJS.zip
Zip=./media/packs/dragon.zip
Zip=./media/packs/fresneldemo.zip
Zip=./media/packs/ogretestmap.zip
Zip=./media/packs/skybox.zip
#Zip=./media/packs/chiropteraDM.pk3


I only edited the first line fof plugins.cfg because it was broken (it pointed the current directory, which doesn't have plugins in the svn pyogre). Everything else is unchanged:
# Define plugin folder
PluginFolder=/usr/local/lib/OGRE

# Define D3D rendering implementation plugin
Plugin=RenderSystem_GL.so
Plugin=Plugin_ParticleFX.so
Plugin=Plugin_BSPSceneManager.so
Plugin=Plugin_OctreeSceneManager.so
Plugin=Plugin_CgProgramManager.so

I copied and pasted the FrameListener class as-is into runn.py. The code that breaks is the following:
def showDebugOverlay(self, show):
"""Turns the debug overlay (frame statistics) on or off."""
overlay = ogre.OverlayManager.getSingleton().getByName('Core/DebugOverlay')
if overlay is None:
raise ogre.Exception(111, "Could not find overlay Core/DebugOverlay", "SampleFramework.py")
if show:
overlay.show()
else:
overlay.hide()

I'm pretty sure plugins.cfg isn't to blame, since I used the same plugins.cfg file to run the demo examples.

Could I have missed some other thing that I needed to adjust to accomodate the media/ directory's new relative position?

-- Matt

dermont

03-02-2006 05:51:27

I think you may have forgotten to initialise the resource groups. Look in SampleFrameWork->Application:

def _loadResources(self):
"""This loads all initial resources. Redefine this if you do not want
to load all resources at startup."""
ogre.ResourceGroupManager.getSingleton().initialiseAllResourceGroups()


See SampleFrameWork def _setUp, for an example.

SuperElectric

03-02-2006 08:22:27

Whoops! That was exactly it. Thanks again!

I'll start carrying my question-answering weight around here someday. Just, y'know... maybe in two months or so... (0_0;)
-- Matt