Changing world and all objects

Started by Mr_Chaos, November 08, 2017, 08:03:17 AM

Previous topic - Next topic

Mr_Chaos

Hi.

I have an android app using JPCT-AE where the user can select different worlds, when a world is selected I want to show a progressdialog while the data is loading (data is loading asynchroniously using background tasks).
My problem is that sometimes when I change "world" I get exception, that I can see are because jpct-ae is not multi threaded, but how do I fix this.
I have a volatile variable in my renderer, that only allows rendering once the data is loaded, but for some reason i still get crashed in JPCT.
Do I have to pause the GLSurfaceView while loading or ? any ideas on how to do this

EgonOlsen

You have to stop all jPCT related things (i.e. rendering and processing) while loading. Anything else will cause troubles.

Mr_Chaos

How do I do that ?
Currently I'm making sure I don't render anything, but is that enough or do I have to do something else when I'm adding new objects ?

MichaelJPCT

glsurfaceview has a rendermode: WHEN_DIRTY. use this mode and request render every frame.
or put all operations in OnDrawFrame() method.

EgonOlsen

Quote from: Mr_Chaos on November 08, 2017, 04:40:55 PM
How do I do that ?
Currently I'm making sure I don't render anything, but is that enough or do I have to do something else when I'm adding new objects ?
If it crashes when adding new objects, you are rendering something. Can you simply synchronize both code blocks on the same object?