I’m experiencing a subtle bug with reloadTextures();
When sending the app to the background and resuming normally, reloadTextures() is called once and my reload works.
However, when I put the phone to sleep (power button press) and then wake the phone up (power button press and unlock gesture) with the app in the foreground, reloadTextures() gets called twice. this results in a failure to load and white textures. (ofImage class)
I’m posting in pause() and reloadTextures():
08-31 09:38:45.838: INFO/OF(22284): pause()
08-31 09:38:45.838: INFO/OF(22284): ofVideoGrabber: releasing textures
08-31 09:38:48.770: INFO/OF(22284): onResume
08-31 09:38:48.820: INFO/OF(22284): ofVideoGrabber: trying to allocate textures
08-31 09:38:48.820: INFO/OF(22284): ofVideoGrabber: textures allocated
08-31 09:38:48.991: INFO/OF(22284): onSurfaceCreated
08-31 09:38:49.361: INFO/OF(22284): ofVideoGrabber: trying to allocate textures
08-31 09:38:49.361: INFO/OF(22284): ofVideoGrabber: textures allocated
08-31 09:38:50.392: INFO/OF(22284): reloadTextures()
08-31 09:38:51.413: INFO/OF(22284): reloadTextures()
08-31 09:38:53.235: INFO/OF(22284): resize 540,960
for now i’m going to set a flag in pause() and reloadTextures(), so that the reload only happens once, but this should be addressed in the OFAndroid class.
SOLUTION:
For those experiencing similar problems with texture and general drawing reload problems in Android:
Make sure to call all general drawing setups again in the resume() or reloadTextures() functions.
My problem was that ofEnableAlphaBlending() wasn’t valid, since this state of the OpenGL machine isn’t preserved across pause()/resume() cycles when the phone goes to sleep. since my textures contain alpha-information, this resulted in white textures. Calling ofEnableAlphaBlending() in resume() solved my problem.
cheers
/*j