OGL Context/Window getting lost

OK Guys I need some help. My app is almost complete and is ready to ship (outside of a few small bugs). However I have a major issue with OpenGL that I cannot seem to resolve.


Whenever my app is processing (it is a photography app that applies effects) if I switch to the home screen or another activity when I come back to my app its all black. At first I thought it was just the OGL context getting trashed but then I realized by putting in messages and breakpoints that I have no window or view active.  I even get these messages from log (
03-19 17:53:33.598: I/InputDispatcher(759): Dropping event because there is no touchable window at (567, 1146).
) This same thing also happens when I launch a share SEND_TO intent and another activity comes up, when you hit the back button sometimes my app is black and sometimes it works (to get even that close I had to post a Runnable message to have it process it async). 


So what the heck is happening to my window? Or is it just the OGL context unloading my textures and it is showing itself as a window missing?




there could be many explanations for this. does your app successfully turn between portrait and landscape. also more than, say 5 times.

try this too:

start app. turn device off (ie sleep), turn sideways, turn back on.


These are all things that usually break with Juce OGL apps. What API min are you using?



I only allow Portrait but if I turn on Landscape mode it does work to rotate back and forth. However my app resets because I do not save off the state of the app.


Right now I can rotate, shut off, switch apps, etc. and everything works fine. There are 2 cases where the app goes black and that is when I am processing the image and switch apps, or when I do a SEND_TO and then come back to my app from the launched activity (most of the time it will be black but not always).


After a lot of digesting I am thinking it has to do with the processing and Android OS killing it off somehow. My processing is done on a thread so my initial thought is that somehow the thread is not getting killed off properly and is in a stuck state (even thoug I am listening for possible kill messages).


I target minsdk of 14 so 4.0 Android.

do you pause your processing thread when Android gets `onPause'. I think Android likes to kill things that run in the background otherwise.

I've also had a lot of problems with `render' being called at the wrong time. I dont think it likes that either. I put in a number of activity flags that maintain if the app has focus, has a surface, is not paused etc. Anything not completely ok, i don't call render. However, this didnt 100% fix my own problem. It improved, but i still had crashes.