on 14.02.2008 17:01 Jean-Paul Calderone said the following:
On Thu, 14 Feb 2008 16:32:30 +0100, Thomas Boucher <thomas.boucher@student.ecp.fr> wrote: <snip>
What I would like to do is to put properly Twisted and python-ogre together. To do that I have already tried the following ways :
<snip>
But it seems more logical to run ptyhon-ogre in the main loop and twisted on the side (in another thread for example, as soon as the client has decided to connect to the server). Have you any ideas how I could do this properly (with threads, without threads, with the coiterrate ...)?
The best solution would be to really integrate the two loops. I don't know the details of OGRE though, so I can't tell you specifically how to do this. It is tightly dependent on the details of the loops being integrated.
I use python-ogre plus twisted: no threads, twisted has control and a LoopingCall triggers a basic Ogre iteration step (similar to the coiteration idea the OP referenced). Using a LoopingCall provides automatic frame-rate limitation, the coiteration code gives render-as-often-as-possible. Twisted's main loop is by far more complicated than Ogre's default loop, the latter simply runs pumpmessages-render-callframelisteners as often as possible and is easier to integrate into twisted's. cheers, stefan