Main Menu

Brute reset

Started by .jayderyu, January 28, 2009, 04:39:54 AM

Previous topic - Next topic

.jayderyu

Hi i'm back after needing to focus on some physics issues that came up.

Ok this seems a little simple and rather brute force ish. I am trying to recreate World for an initilizing and at the moment I'm looking for the simplest removal and reinitilize.

I have done a
world.dispose();
buffer.dispose();
...
world = new World();
... redoing all everything

what happens is that I am left with the last frame and nothing updates.
I know there is updating going because my window for the 2d physics is works fine.

EgonOlsen

Disposing the buffer shouldn't be required in this case. The frame buffer isn't coupled to the world or to any objects in any way, so it can stay like it is and be reused. I suggest to add a call to World.removeAllObjects(); before disposing the world to ensure that all objects are free again (are you reusing them?). You can add a World.removeAllLights(); too, but that shouldn't be required.
Apart from that, i don't see why it shouldn't work. Maybe reusing the frame buffer already fixes the problem!?

.jayderyu

oh thanks for the info. I will add these remove all stuff. After looking into it some more I missed. I may or may not end up reusing them, but really I am reseting so I can just "reset" when I make changes to the script code. that way I get code changes with no compiles or restarting the app. Works like a charm now :)

buffer.disableRenderer(IRenderer.RENDERER_OPENGL);

thank you. your awesome. escpecially at this late night. it's 3am where I am :)