1
General discussions / Android GL context loss
« on: April 15, 2015, 11:19:09 am »
It is well known that Android will "randomly" decide to kill the GL context of apps that is switched to the background or if your device goes to sleep, etc. If that happens all your textures are lost when the context is lost.
Its hard to find a device to reproduce this problem consistently, so debugging/fixing is not easy. We only hear about it from people using the app.
Does SFML recreate the GL context when it is lost? The way to do it, according to Google, is when you try to do a eglSwapBuffers, and get an error, the error returned will be that one of the 3 parts of the context is lost. Surface/Display/<Something else>. So doing a proper shut down of everything and recreating when that happens seems like a simple thing to do.
The harder part is to reload all the textures that is lost, but this is not SFML's responsibility. There should however be some way to tell if the context was recreated or not at runtime so that the app can respond appropriately.
Some input would be appreciated.
Its hard to find a device to reproduce this problem consistently, so debugging/fixing is not easy. We only hear about it from people using the app.
Does SFML recreate the GL context when it is lost? The way to do it, according to Google, is when you try to do a eglSwapBuffers, and get an error, the error returned will be that one of the 3 parts of the context is lost. Surface/Display/<Something else>. So doing a proper shut down of everything and recreating when that happens seems like a simple thing to do.
The harder part is to reload all the textures that is lost, but this is not SFML's responsibility. There should however be some way to tell if the context was recreated or not at runtime so that the app can respond appropriately.
Some input would be appreciated.