I'm developing simple Android game in OpenGL ES 2.0 and the development stage is getting closer to publishing game on play store, but I'm still unsure about EGL context behaviour on different devices.
GLSurfaceView Android documentation says:
A GLSurfaceView must be notified when the activity is paused and resumed. GLSurfaceView > clients are required to call onPause() when the activity pauses and onResume() when the > activity resumes. These calls allow GLSurfaceView to pause and resume the rendering thread, and also allow GLSurfaceView to release and recreate the OpenGL display.
Problem is that I don't want my game to recreate and reload all textures after every activity change or home button press, it really breaks user experience, so I don't invoke onPause and onResume methods on my GLSurfaceView in order to not loose my OpenGL assets. This approach works perfectly on some devices I've tested - Nexus 7 and Lenovo Yoga Tab 2, but I'm afraid it may cause some unexpected results on some specific devices. What are the drawbacks of this approach? Can I workaround EGL context lost in some other way?
I've read many resources about this subject but most of them are related to Android in version 2.x and were written 3-4 years ago. I'm targeting minimum API 16 which is Android 4.1.x, so maybe there are some new ways to work this out?
I did use some custom GLSurfaceView implementations as the one from Chris Pruett's game Replica Island but as I've said those workarounds were targetting older Android versions and still they didn't let me solve my problem. I was also trying using setPreserveEglContextOnPause method on GLSurfaceView but it doesn't seem to work.
GLSurfaceView
is to prevent the app from rendering in background when the user switches to something else: failing to do so will cause the battery to drain at alarming rates, and that's a sure way leading to bad reviews and application uninstalls... \$\endgroup\$