Author Topic: Object and Texture lost after Activity resume  (Read 2305 times)

Offline guillaume

  • int
  • **
  • Posts: 67
    • View Profile
Object and Texture lost after Activity resume
« on: February 04, 2012, 08:55:06 am »
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 =================
Code: [Select]
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Object and Texture lost after Activity resume
« Reply #1 on: February 04, 2012, 10:28:05 am »
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.

Offline guillaume

  • int
  • **
  • Posts: 67
    • View Profile
Re: Object and Texture lost after Activity resume
« Reply #2 on: February 06, 2012, 04:08:16 am »
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.