Py Ogre - Basic Tutorial 4 problems

ccc

23-08-2011 23:45:09

I noticed a few problems with the Basic Tutorial 4 source code; two of these are bugs, and two of them are features that are in the C++ tutorial but not the Python version.

Bugs:
Pressing Q quits the program; it should move the camera up.
Moving the mouse without holding down RMB still rotates the camera.

Missing features from the C++ tutorial:
The camera movement is along global coordinates, not local. So if you rotate the camera 90 degrees, the arrow key controls are all wrong.
Camera 2's rotation is not independent of camera 1's. If I switch to camera 2, rotate, then switch back to camera 1, then camera 1 is no longer pointing in the same direction.


Has anyone else noticed these?


EDIT:
Same problems in Basic Tutorial 5. Also, the light toggle isn't working in BT5's source code, so if you hold down the LMB, the light flickers, and whether the light turns on or off when you want it to depends on how well you time your mouse clicks.

iwanantonowitsch

24-08-2011 17:44:05

quite possible but not really relevant as you figure these problems out pretty fast -and- it helps you understand ogre better if you have to solve these easy bugs.

ccc

25-08-2011 15:25:09

I see where you're coming from, and I agree that fixing bugs is a good way to learn, but I don't think that a Basic Tutorial is really the place for that. On the one hand, the "missing features" that I listed above aren't really something the tutorial says the code is doing, so maybe those could be listed in an "Exercises for the Reader" section. On the other hand, if the tutorial says that this is how you do something, then the code should actually do it. Here I'm referring to the bugs with the Q key and the right mouse button; those are things that should be fixed.

The problem with buggy tutorials like this one is that they send two messages:
1 - the software itself is unreliable, and/or
2 - the software is not well supported (i.e., you're on your own, so use at your own risk).

I'm new to Python-Ogre, and from what I've seen so far, it seems to me that the second case is true here. I don't mean to complain; I'm perfectly happy to contribute time to help make things work better, and I'd be willing to fix the tutorial myself once I figure out how to fix the code. I've just been pretty busy over the past couple of days so I haven't had time to work it out for myself yet.

dermont

25-08-2011 18:09:16

The tutorials are pretty dated and probably need updating. For your first bug in Tutorial4 try updating the tutorial code.


###def frameStarted(self, frameEvent):
def frameRenderingQueued(self, frameEvent):

ccc

25-08-2011 20:02:27

Actually, that fixes everything in both tutorials!
So was that problem due to a change in the Python-Ogre API, or just the way the Sample Framework was coded?

Edit - I see from the C++ tutorials that each frame calls a frameStarted function, a frameRenderingQueued function, and a frameEnded function. Is this a new feature (as in, newer than the Python tutorial)? Are all of these functions called in the PyOgre API? It seems like they probably aren't since frameStarted apparently didn't do anything. Or maybe they are, and the frameStarted function just isn't the right place for handling user input.

iwanantonowitsch

25-08-2011 21:52:43

i think both the tutorial and the sample framework are outdated. when i started i coulndt get rid of the framework fast enough :D i dont know if youre just comparing but theres also a python ogre tutorial. diggin through the api was my best teacher, though. not quite as fun but you'll soon find out theres a solution for just ANYTHING.

dermont

25-08-2011 22:07:42

Actually, that fixes everything in both tutorials!
So was that problem due to a change in the Python-Ogre API, or just the way the Sample Framework was coded?

Edit - I see from the C++ tutorials that each frame calls a frameStarted function, a frameRenderingQueued function, and a frameEnded function. Is this a new feature (as in, newer than the Python tutorial)? Are all of these functions called in the PyOgre API? It seems like they probably aren't since frameStarted apparently didn't do anything. Or maybe they are, and the frameStarted function just isn't the right place for handling user input.


It was a update to Ogre and yes a new feature after some of the tutorials were written:
http://www.ogre3d.org/tikiwiki/ShoggothNotes

Look at sf_OIS.py - everything that used to be handled in frameStarted is now done in frameRenderingQueued as per the C++ demos.

The problem with the tutorials you mentioned is that you are overriding/handling user input in the frameStarted method and user input is also handled in sf_OIS.py (frameRenderingQueued). You can take a look at OgreRoot.cpp for the exact order of execution, but it goes something like:

fireFrameStarted
..
fireFrameRenderingQueued
..
fireFrameEnded

ccc

25-08-2011 22:31:20

I do plan to learn from the API as soon as I work through the tutorials; that's the best way to learn. I just like going through the tutorials first so I get a feel for the API.

Did you say there's a Python Ogre tutorial that's different from the standard Beginner/Intermediate series? Where do I find that? Google just keeps pointing me back to these ones.

iwanantonowitsch

26-08-2011 17:29:07

when i started i used the python-ogre tutorial on the python-ogre wiki page.

http://wiki.python-ogre.org/index.php/Basic_Tutorial_1

this