I try to share EGL context bwteen 2 GLSurfaceViews by following code:
createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
EGLContext shared = ...; // a cached egl context
int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
EGLContext context = egl.eglCreateContext(display, eglConfig, shared == null ? EGL10.EGL_NO_CONTEXT : shared,
attrib_list);
return context;
}
}
The code works on most of the android phones (OS>=2.2) but failed on all the tested tablets.
01-12 18:33:35.381: E/AndroidRuntime(12171): FATAL EXCEPTION: GLThread 11
01-12 18:33:35.381: E/AndroidRuntime(12171): java.lang.RuntimeException: eglMakeCurrent failed: EGL_BAD_ACCESS
01-12 18:33:35.381: E/AndroidRuntime(12171): at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1146)
Since I declared the LOCAL_LDLIBS: = -lGLESv2, the EGL is a 2.0 context.
Why it failed on tablets(xoom, galaxy, lg, sony, etc)
Any insight is appreciated.
Two possible reasons for this failure (from the EGL spec):
It could also be that the GPU you are using on tablets does not support shared context.