Textures and Shaders not being reloaded on android


Hi, I recently updated to cocos2d-x 2.1.4.

I’ve noticed that when returning to my application after pressing the home button, some of the textures (but not all) are replaced with black squares, and my shaders are unloaded.

As you can see:

Is there a way to prevent this?



I think it is the same issue as https://github.com/cocos2d/cocos2d-x/issues/3029.


Yeah, I think so. There’s a method in GLSurfaceView that looks like it might help, https://developer.android.com/reference/android/opengl/GLSurfaceView.html#setPreserveEGLContextOnPause(boolean) , but it’s only available in Android 3.0 and up, and I don’t know if it works. I think I’ve tried it before.