Join GitHub today
x/mobile: preserve eglContext when activity paused on Android #26962
I have read some code in
This will cause the application lost eglContext when activity is paused(eg: press Home). A simple way to avoid this is to preserve the eglContext(only destroy Surface) and reuse it when needed. I have also make some research:
PS: The sample app basic don't have the problem, cause it recreate the shader/index-buffer/vertex-buffer each time the window recreated, but it's impossible in a game with large amount of textures and buffers .
I have write some code to test the idea, very simple, just declare the eglContext as a global variable.
It works. But my code is not well tested (only on my own android device).