keweibing / cocos2d-android

Automatically exported from code.google.com/p/cocos2d-android
Other
0 stars 0 forks source link

Tests/Demos: Activities onPause / onResume has to call mGLSurfaceView.onPause()/.onResume; #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When the Activity is paused or resumed it also has do be forwarded to the
GLSurfaceView.

Fix in all Examples/Tests:

 @Override
    public void onPause() {
        super.onPause();
        mGLSurfaceView.onPause();
        Director.sharedDirector().pause();
    }

    @Override
    public void onResume() {
        super.onResume();
        mGLSurfaceView.onResume();
        Director.sharedDirector().resume();
    }

Suggestion:
Create a Cocus2dActivity that encapsulates GLSurfaceView (and maybe a
PowerManager.WakeLock)

Original issue reported on code.google.com by christop...@gmail.com on 6 Apr 2010 at 1:52

GoogleCodeExporter commented 8 years ago
I've done some testing with and without the mGLSurfaceView.onPause() / 
mGLSurfaceView.onResume() and found that including these lines can cause 
problems.

After locking the screen (hangup button), then waking, the texture maps seem to 
get scrambled (eg sprites show the wrong texture, or white boxes) sometimes 
followed by a silent crash of the Activity (eg, no force close, Activity just 
dies as if the back button were pressed). Removing the mGLSurfaceView.on* lines 
resolves the problem.

I see this behavior on the Android 2.2 (and 1.6) emulator, using svn r105 of 
cocos-android. Curiously, on a real device running Android 2.2 the texture 
scrambling bug *always* occurs upon locking/unlocking the screen, irrespective 
of explicitly setting the state of mGLSurfaceView. Anyone have any ideas why 
this is happening ?

Original comment by AndrewJa...@gmail.com on 19 Sep 2010 at 4:45

GoogleCodeExporter commented 8 years ago
The symptoms described here are similar to those described in Issue 23. I 
suspect it's the same bug.

Original comment by AndrewJa...@gmail.com on 1 Oct 2010 at 11:11

GoogleCodeExporter commented 8 years ago
Hi,

I have a white screen each time the application resume (multi-task). 
Adding  mGLSurfaceView.onPause(); and mGLSurfaceView.onResume(); do not change 
anything.

I use an HTC desire 2.1
Is there an existing fix for this bug ?

Original comment by dringapp@gmail.com on 20 Dec 2010 at 11:12

GoogleCodeExporter commented 8 years ago
@dringapp
thats a normal openglsurface context loss. 
all resources(textures,vbo) have to be reloaded in this case.
this should be handled by the engine. so a suggest you open a new issue.

Original comment by christop...@gmail.com on 21 Dec 2010 at 2:40