Python Ogre Tutorials question

alonechild101

09-03-2009 02:57:49

Are there any tutorials for beginners that DO NOT use the sample framework?

skorpio

09-03-2009 07:25:33

Hello,

I'm sure that you can find some examples that doesn't use it. But most of samples are gear to use it.

I'm working with wxOgre Framework which allows you to create python-ogre stand alone applications using a windows interface.
It doesn't use the framework. It uses the concepts of classes to group code so it can be re-used over and over.

All the stand alone apps have a class (sceneApp) to build a Scene, they inherits their behavior from classOgreCore().
classOgreCore() implements the input side (keys and mouse) by calling classInputManager; it also initializes ogre and resources.

Basically, sceneApp() is used to create a scene and provide 'hooks' for all the really common stuff you may want to do.

Another difference, is that, there is no frameListener. I use the main() function to run a while loop,
which calls ogre render_one() function, which was created under classOgreCore

It is very similar to framework, but somehow, it seems more accessible or visible to the user.

demo_MySimpleApp.py ( I don't think it will run, but it shows the basic structure)



## scenApp created by main() at the bottom.
class sceneApp(classOgreCore):
def _build_scene(self):
## called from classOgreCore
self.sm = self.root.createSceneManager(ogre.ST_GENERIC)
self.rn = self.sm.getRootSceneNode()

def key_down(self,key):
## called from classInputManager
pass

def key_up(self, key):
## called from classInputManager
pass

def frame_started(self):
## called from classOgreCore
pass

def frame_ended(self):
## called from classOgreCore
pass

def mousePressed(self, evt, btn):
## called from classInputManager
pass

def mouseReleased(self, evt, btn):
## called from classInputManager
pass

def mouseMoved(self, evt):
## called from classInputManager
pass

def onClose(self):
## called from classInputManager -- keyReleased()
pass

def main():
app = sceneApp()
while not app.renderWindow.isClosed():
ogre.WindowEventUtilities().messagePump()
if app.renderWindow.isActive():
app.render_one()
time.sleep(0.0001)
else:
time.sleep(.1)
app.shutdown()


if __name__ == "__main__":
main()



You can check some of examples under wxOgre topic. There is code, samples and documentation on how to install all the necessary packages.

Best Regards,

Skorpio

theTrav

31-03-2009 03:39:52

Or just look at tutorial6 which goes through setting up ogre without SampleFramework

As an aside, this is the first thing I wanted to look at too, I wish it was either identified as the first "proper" tutorial, or put earlier in the listing as I certainly don't give a hoot about fog and sky boxes and didn't really need to learn them before learning how to properly initialize the engine