Correct way to shutdown & cleanup

MacMan45

26-04-2008 00:25:30

I've been working with python-ogre for a while now, getting the hang of it all.

One thing I am having trouble with though, is properly shutting down & cleaning up.

I have started a new project using unit testing from the start, and I have found an issue I haven't had to deal with in previous programs.

As I want to be able to start & stop ogre a few times during testing, I'm not sure how to completely shutdown & restart ogre cleanly.

I have tried calling shutdown on root & then deleting all references I hold to root. I then recreate root & when I get to creating a new window, I get a message about not being able to access a memory region (windows xp) & all I can do is close the error message and then IDLE & open editor windows close on me.

Does anyone know how to completely clean up ogre & start fresh, without having to restart the program completely?

ethankennerly

04-06-2008 05:19:59

Hello. I'm also unit-testing my Python-Ogre code. Until today, I've been unable to handle resources, because I didn't create a render window or initialise resources. Today, I saw the Ogre Ruby unit test, which is quite clean (as is Ruby's syntax).

http://www.ruby-forum.com/topic/125444
http://ogrerb.rubyforge.org/

I followed Jason Roelofs' succinct setup code and am now able to unit test some simple resources. For teardown, I noticed that he clears scene and garbage collects. For teardown, I personally delete the application (or rather I let doctest delete the application). It's sloppy, but my unit tests are light, so they're only a few seconds anyway.

Personally, I do not use IDLE as the interpretter. I execute unit tests from vim, or interactively test in PythonCard, as the precursor to an editor ( http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=7134&start=15 ). In the past, I seem to recall Ogre getting grumpy when executed in IDLE. I don't remember now. I just execute from command line without a problem. There are several gotchas in Ogre that I had to avoid, but that was mostly in the setup, and occasionally in the teardown for special cases, such as disabling the log.

Hope some of that helps in your case. By the way, I'd be interested on collaborating on lightweight unit test toolkit and functions. For my MFA thesis, I've written my own and am proud that it satisfy my needs so far, but the work takes time from developing the content. And I could learn a lot more about basic Ogre and advanced Python from a seasoned programmer.

-- Ethan
http://runesinger.com