Object and Texture lost after Activity resume

Started by guillaume, February 04, 2012, 08:55:06 AM

Previous topic - Next topic

guillaume

hi, I have two  jPCT-AE activity, activity A starts activity B, after back from B to A, some objects
and textures of activity A lost, not show on the screen, what's the problem here ? thanks.

=========== renderer resume code =================

public void onSurfaceChanged(GL10 gl, int width, int height) {
// TODO Auto-generated method stub
if (fb == null) {
Logger.log("==== Launcher launch: " +width+"X" +height);
fb = new FrameBuffer(gl, width, height);
mLauncher.tearDown();
mLauncher.setup();
mLauncher.setFrameBuffer(fb);
mLauncher.setFrameBlitter(new AndroidFrameBlitter(fb));

}else{
fb.dispose();
fb = new FrameBuffer(gl, width, height);

mLauncher.setFrameBuffer(fb);
mLauncher.setFrameBlitter(new AndroidFrameBlitter(fb));
}
}


ps:  activity B starts a normal android ui activity C , and when back from C to B, the objects and texture is ok.
the renderer code is similar.

EgonOlsen

Sound a little bit like the issue that we discussed in the thread in the bugs section lately (though it wasn't a bug...). If you are using two Activities with two different renderers at the same time, make sure that they don't share the same FrameBuffer, because that would make Activity A use a GL context that is actually meant to be used by Activity B and that will lead to funny results. Please download the jar mentioned here: http://www.jpct.net/forum2/index.php/topic,1657.msg18774.html#msg18774, set the log level to debug and post the log output.

guillaume

after reading the mentioned thread, I found my problem is not using one FrameBuffer in two thread.
the cause is I flush the textureManager in my logic. now I have resolved it. thanks.