Some demos of Python Ogre version 1.6.0 don't work

5 views
Skip to first unread message

Gourry G

unread,
Dec 25, 2008, 2:15:57 AM12/25/08
to Python Ogre Developers
Hi,

When I was following the tutorial 4, I've seen that even when I
shouldn't be able to move the camera, I could move very sluggishly
(like if the computer was lagging). I tried then some demos that use
SampleFramework and still rebind the keys, and I see the same strange
behavior. Worst, some demos don't work well because of that.
For instance, in Demos\ogre\Demo_bspcollision.py, when I press the
space key a ball is created but it doesn't move. And I can still move
trough walls.
And less important, some demos like water1.py are not runnable because
of some errors.

I'm running under windows XP sp2 with python 2.5.2 and ogre 1.6
(stable). My GC is a NVidia eVGA 7600 GTO.

What should be my next step to troubleshoot this?

Thanks.

Andy Miller

unread,
Dec 25, 2008, 3:15:21 AM12/25/08
to python-ogre...@googlegroups.com
Water demo isn't finished/working and demo_bspcollision doesn't do any checking on the camera movement so walking through walls is OK (and while I thought I'd fixed the ball issue I may not have - it's related to Ogre's ODE support - check the OgreODE demos instead)..

Can you give an example of other demos that show the sluggish movement you are seeing...

Andy

2008/12/25 Gourry G <gourry....@gmail.com>

Gourry G

unread,
Dec 25, 2008, 2:06:37 PM12/25/08
to Python Ogre Developers
Merry Christmas,

Yes, I thought so that the demos may not be stable, but I wanted to
have it confirmed. Thanks.

Where I first saw the problem was in the tutorial 4 of the wiki:
http://wiki.python-ogre.org/index.php/Basic_Tutorial_4

At the point the keyboard and mouse are captured, I was expecting to
not be able to move anymore but it when the bug appeared.
If I may, this is my source code:
#**************************************************************
import ogre.renderer.OGRE as ogre
import ogre.io.OIS as OIS
import SampleFramework as sf

class TutorialFrameListener(sf.FrameListener):
def __init__(self, renderWindow, camera, sceneManager):
sf.FrameListener.__init__(self, renderWindow, camera)
self.toggle = 0
self.mouseDown = False

self.camNode = camera.parentSceneNode.parentSceneNode
self.sceneManager = sceneManager

self.rotate = 0.13
self.move = 250


def frameStarted(self, frameEvent):
if(self.renderWindow.isClosed()):
return False

self.Keyboard.capture()
self.Mouse.capture()

currMouse = self.Mouse.getMouseState()

if currMouse.buttonDown(OIS.MB_Left) and not self.mouseDown:
light = self.sceneManager.getLight('Light1')
light.visible = not light.visible
self.mouseDown = currMouse.buttonDown(OIS.MB_Left)

if self.toggle >= 0:
self.toggle -= frameEvent.timeSinceLastFrame

if self.toggle < 0 and self.Keyboard.isKeyDown(OIS.KC_1):
self.toggle = 0.1
self.camera.parentSceneNode.detachObject(self.camera)
self.camNode = self.sceneManager.getSceneNode("CamNode1")
self.sceneManager.getSceneNode("PitchNode1").attachObject
(self.camera)
elif self.toggle < 0 and self.Keyboard.isKeyDown(OIS.KC_2):
self.toggle = 0.1
self.camera.parentSceneNode.detachObject(self.camera)
self.camNode = self.sceneManager.getSceneNode("CamNode2")
self.sceneManager.getSceneNode("PitchNode2").attachObject
(self.camera)





return not self.Keyboard.isKeyDown(OIS.KC_ESCAPE)

class TutorialApplication(sf.Application):
def _createScene(self):
sceneManager = self.sceneManager
sceneManager.ambientLight = 0.25, 0.25, 0.25
entity = sceneManager.createEntity('Ninja', 'ninja.mesh')
node = sceneManager.getRootSceneNode().createChildSceneNode
('NinjaNode')
node.attachObject(entity)
light = sceneManager.createLight('Light1')
light.type = ogre.Light.LT_POINT
light.position = 250, 150, 250
light.diffuseColour = 1, 1, 1
light.specularColour = 1, 1, 1

node = sceneManager.getRootSceneNode().createChildSceneNode
('CamNode1', (-400, 200, 400))
node.yaw(ogre.Degree(-45))
node = node.createChildSceneNode('PitchNode1')
node.attachObject(self.camera)
node = sceneManager.getRootSceneNode().createChildSceneNode
('CamNode2', (0, 200, 400))
node.createChildSceneNode('PitchNode2')




def _createCamera(self):
self.camera = self.sceneManager.createCamera('PlayerCam')
self.camera.nearClipDistance = 5

def _createFrameListener(self):
self.frameListener = TutorialFrameListener(self.renderWindow,
self.camera, self.sceneManager)
self.root.addFrameListener(self.frameListener)
self.frameListener.showDebugOverlay(True)

if __name__ == '__main__':
try:
ta = TutorialApplication()
ta.go()
except ogre.OgreException, e:
print e

#***********************************************************************

I still try to find others demos that use SampleFramework and override
the keys/mouse, but no luck so far.

But thanks already for your help.

On Dec 25, 12:15 am, "Andy Miller" <nzmill...@gmail.com> wrote:
> Water demo isn't finished/working and demo_bspcollision doesn't do any
> checking on the camera movement so walking through walls is OK (and while I
> thought I'd fixed the ball issue I may not have - it's related to Ogre's ODE
> support - check the OgreODE demos instead)..
> Can you give an example of other demos that show the sluggish movement you
> are seeing...
>
> Andy
>
> 2008/12/25 Gourry G <gourry.gabr...@gmail.com>

Andy Miller

unread,
Dec 25, 2008, 6:18:01 PM12/25/08
to python-ogre...@googlegroups.com
Change your frameStated method to frameRenderingQueued and it should work as you expect..

If you look at the sample framework source (sf_ois.py) you can see that all the input is managed in the frameRendereringQueued function which is a change since the tutorials were written, in fact a change in Ogre 1.6 -- it all used to be done in frameStarted..

Andy

2008/12/26 Gourry G <gourry....@gmail.com>

Gourry G

unread,
Dec 25, 2008, 8:38:27 PM12/25/08
to Python Ogre Developers
Thank you so much, Andre.

As a fake beginner in Python, and a true beginner in Ogre, I go in
simple problems like that and wonder where the problem could be. So,
your help is like a Christmas present for me.

On 25 déc, 15:18, "Andy Miller" <nzmill...@gmail.com> wrote:
> Change your frameStated method to frameRenderingQueued and it should work as
> you expect..
> If you look at the sample framework source (sf_ois.py) you can see that all
> the input is managed in the frameRendereringQueued function which is a
> change since the tutorials were written, in fact a change in Ogre 1.6 -- it
> all used to be done in frameStarted..
>
> Andy
>
> 2008/12/26 Gourry G <gourry.gabr...@gmail.com>
Reply all
Reply to author
Forward
0 new messages