I have some errors when i use camera


22-12-2005 18:15:32

Hello, here is my code:

from pyogre import ogre

class App:
def __init__(self):
self.root = None
self.rendu = None
self.mng = None
self.camera = None

def Init(self):
self.root = ogre.Root(ogre.getPluginPath())
init = self.root.showConfigDialog()
if init:
self.rendu = self.root.initialise(True)
self.mng = self.root.getSceneManager(ogre.ST_GENERIC)
self.camera = self.mng.createCamera('cam')

if __name__ == '__main__':
ap = App()

I have a problem with the line
self.camera = self.mng.createCamera('cam')
when I execute the program, i have the error "Runtime Error" but if i remove this line I have not this error!
Why ?


23-12-2005 06:13:00

I have only recently starting using pyogre, so treat my reply with grain of salt. I looked at sampleframework.py (which you might want to look at)

it has a function which gets called before the createCamera.
the function is _setupResources()

def _setUpResources(self):
"""This sets up Ogre's resources, which are required to be in
config = ogre.ConfigFile()
config.loadFromFile('resources.cfg' )
for section, key, path in config.values:
ogre.ResourceGroupManager.getSingleton().addResourceLocation(path, key, section)

This might be the reason why your app is tripping over ?


23-12-2005 10:45:40

Thanks !