How to shutdown PyOgre

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
jwatte
Gnome
Posts: 347
Joined: Sat Feb 05, 2005 12:56 am

How to shutdown PyOgre

Post by jwatte »

I upgraded to Python 2.4 and the latest version of PyOgre. I'm trying to run the demos from within the PyALaMode environment that comes with wxPython (or, for that matter, from within the command-line shell).

The problem is that the D3D window doesn't go away when the demo is done. Even if I do "del" on the application object, the window hangs around. Because PyOgre doesn't come with much documentation, I'd like to ask the community at large how to go about shutting down the sample after it's done running (so I can easily edit it and run it again, say).
User avatar
fog
Greenskin
Posts: 149
Joined: Sun Sep 19, 2004 6:00 pm
Location: Torino, ITALY

Post by fog »

I suppose the problem is the Root object singleton still lying around. I never tried deleteing and recreating it but if the C++ code has no problems with it that should be a fast way to reset Ogre (and make the window disappear.)
User avatar
fog
Greenskin
Posts: 149
Joined: Sun Sep 19, 2004 6:00 pm
Location: Torino, ITALY

Post by fog »

Ok, I just tested it by changing the TerrainDemo.py application to say:

Code: Select all

if __name__ == '__main__':
    application = TerrainApplication()
    application.go()
    del application
    application = TerrainApplication()
    application.go()
This runs the demo two times in a row and deletes the rendering window in between. There are probably better ways (as managing the RenderWindow directly) but this one actually works and requires no extra code.
User avatar
jwatte
Gnome
Posts: 347
Joined: Sat Feb 05, 2005 12:56 am

Post by jwatte »

Sadly, it's the second creation of the application that closes the window. The "del application" part does not close the window. I e, the only way to "close" the window is to create another window again. I'd like to close it without having to re-create another window.