crash on surface re-Create
a lost opengl context on android destroys all glTextures.
cocos2dx should reload or recreate all lost textures. this don’t look possible yet with the current framework.
currently cocos2d crashes when screen changes orientation
or when the game comes back to the foreground after being paused
I have viewed the source code of cocos2d-android-1, it reload all the resources when re-create opengl context. I don’t think it is a good method. I will research good method.
in my other games, using my own engine (very simple engine), i found no other solution but had to reload the textures.
i hope you find a good solution. take a look at love2d engine
?? EGL Context Lost
There are situations where the EGL rendering context will be lost. This typically happens when device wakes up after going to sleep. When the EGL context is lost, all OpenGL resources (such as textures) that are associated with that context will be automatically deleted. In order to keep rendering correctly, a renderer must recreate any lost resources that it still needs. The onSurfaceCreated(GL10, EGLConfig) method is a convenient place to do this.
??
i think we all have no choice but to reload textures. for dynamic textures like the atlas - we will have to find the best cross platform solution
I can’t use the hacked version with the VolatileTexture because I need the memory. Wouldn’t it be a better idea to keep the VolatileTexture from doubling the texture data until the app is about to pause?
(and of course, the double data should then be deleted again when resuming the app, right after reuploading to GL)
You can take a look at this issue: #374. It have been fixed.
We cache the texture info instead of cache the data now. And the change will be published next version.