PyOgre Tutorial2

From Ogre Wiki

Jump to: navigation, search

PyOgre example (\Python24\pyogre\demos):

# This code is a complete OGRE application with a space sky plane
# and a dragon in the middle of the space
# move your camera with the mouse and use W-A-S-D keys

Don't forget to install prior to starting the example listed below:


import pyogre.ogre as ogre
import SampleFramework as sf

class SkyPlaneApplication(sf.Application):
    def _createScene( self ):
        sceneManager = self.sceneManager
        camera = self.camera
        
        sceneManager.ambientLight = (0.5, 0.5, 0.5)   

        plane = ogre.Plane()
        n = plane.normal
        n.x, n.y, n.z = 0, -1, 0
        plane.d = 5000
        #sceneManager.setSkyDome(True, 'Examples/CloudySky', 5, 8)
        sceneManager.setSkyPlane(True, plane, 'Examples/SpaceSkyPlane', 10000, 3)
 
        light = sceneManager.createLight('MainLight')
        light.position = (20, 80, 50) 

        entity = sceneManager.createEntity('dragon', 'Cube.mesh')
        sceneManager.rootSceneNode.attachObject(entity)

if __name__ == '__main__':
    application = SkyPlaneApplication()
    application.go()

To run this application, go to folder C:\Python24\pyogre\demos and start one of the example applications (files ending *.py) by typing:

python SkyPlaneApplication.py
PyOgre Tutorial

PyOgre Beginner Tutorial: Beginner 1 - Beginner 2 - Beginner 3 - Beginner 4 - Beginner 5

PyOgre Tutorial: Page 1 - Page 2 - Page 3 - Page 4

Ogre Tutorials: Basic Tutorial 1 - Intermediate Tutorial 1 - Tutorial 1

See also: PyOgre - Ogre Tutorials - Artist Tutorials - Ogre Articles - Cookbook

Personal tools
administration