MobileVisuals <eyvind <at> astralvisuals.com> writes: > > My app has a SurfaceView and a GLSurfaceView. I can switch back and > forth between these. The SurfaceView is the application GUI. > > I test switching to another app. I can then switch back to the > GLSurfaceView in my app. I then try to switch back to the > GLSurfaceView,where the application GUI is. Here is where the problem > occurs. A black screen is shown instead of the GUI. > > The app still works, because the application menu is shown when the > menu button is pressed. But nothing is drawn on the screen, it is only > black. I have tried almost everything to fix this, I have checked that > the thread is running and that no instance of any object (like the > SurfaceHolder) is null. What could be the reason for this black screen? >
I had the same problem with my app. The problem is that you lose the GL context if your application goes to the background, and so you lose all bound textures (if you're using texture mapping), and you also lose the viewport. You need to reload all your textures and you need to re-set your viewport and projection matrix, etc. You should do this on your activities onResume() method, but you won't have a GL context there, so just set a flag in your renderer to tell it to reload everything. Your renderer will NOT always get an onSurfaceChanged() call after the resume, so don't rely on that to reset your viewport! Because you can't rely on onSurfaceChanged(), you also need to use saved values to set viewport width and height. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

