I'm having some issues with running PyOgre and using Python's time and datetime modules. After calling root.initialise(True), time functions in Python act as if time has stopped. For instance, the value of time.time() never increases. I'm running on Windows XP and have not tested this in Linux just yet. I am using pyogre-1.0.6 and Python 2.4.3.
An easy way to show this behavior is to just run the following code every frame:
Sometimes, I've noticed it'll change every few minutes, but for the most part, it stays the same. This is causing some major issues with other modules I'm using (Twisted for example).
Anyone have any ideas? Perhaps it's my setup or something else I'm doing wrong-- I'm very new to Ogre. If I call root.initialise(False), time works, but then I don't have anything to render to.
Any help or ideas would be appreciated.
No solution, but I just tested it with pyogre-1.2 and got the same behavior.
Good to know it wasn't my set up. Thanks for letting me know. I'm still working on compiling PyOgre 1.2 on Linux, but I doubt there will be a problem there. I see other people here using PyOgre and Twisted, so it must work somewhere. I'll post when I have it working on Linux.
It works fine on Linux. If anyone has any clues as to why this may be happening, I'm definitely interested in hearing them. Otherwise, I'll probably go about digging through PyOgre and Ogre to trace the initialise function and see what it's doing to Windows time functions.
I stopped doing development on Windows in favor of Linux for a while because of this bug. I just went back to try a few more ways to fix this problem on Windows and I found the solution.
I certainly should have tried this before, but using the OpenGL renderer instead of DirectX makes everything work fine.
I noticed that in very simple unit tests too... sometimes I get "Tests ran in <negative number> seconds."
Using the clock() function instead is very robust.
I encounter the same issue in similar circumstances in my project, but not using PyOgre.
I'm using standard C++ Ogre SDK but I'm calling Python code from my C++ project through embedding.
I'm facing exactly the same problem: after calling root.initialise(), the value of time.time() never or rarely increases ; also if I try:
test = time.time()
target = test + 30.0
then "target" wasn't increased by 30.0 and still has the same value as "test"!
This is very annoying because I'm embedding some complex python code and it's not trivial to modify it in order to use "time.clock()" instead of "time.time()"
I confirm that it's working fine with OpenGL but I don't want to tie my customers to OpenGL, they shoulp be able to opt for Direct3D if they wish.
The question is: is that problem caused by Ogre or by Direct3D?