You can save your GlContext when your application rotates so that it is not destroyed.
Instead of rewriting the entire GlSurfaceView, you can simply provide an EGLContextFactory to change how GlContext is created / destroyed.
public class ConfigChangesGlSurfaceView extends GLSurfaceView { private static final int EGL_CONTEXT_CLIENT_VERSION_VALUE = 2; private static EGLContext retainedGlContext = null; private boolean changingConfigurations = false; public ConfigChangesGlSurfaceView(Context context) { super(context); init(); } public ConfigChangesGlSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); init(); } private void init() { changingConfigurations = false; setEGLContextClientVersion(EGL_CONTEXT_CLIENT_VERSION_VALUE); setEGLContextFactory(new GLSurfaceView.EGLContextFactory() { private final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig config) { if (retainedGlContext != null) {
source share