I am trying to use multiple EGL contexts to load textures outside the main thread. I get an error EGL_BAD_CONTEXTafter my call eglCreateContext.
Inside my android.opengl.Renderer
public void onSurfaceCreated (javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) {
EGLContext sharedContext = egl.getCurrentContext();
EGLDisplay display = eglGetCurrentDisplay();
eglCreateContext(display, config, sharedContext, new int[] { EGL_CONTEXT_CLIENT_VERSION, 2 } );
}
EGL_BAD_CONTEXTwill lead me to the documentation here which says
EGL_BAD_CONTEXT is generated if share_context is not an EGL mapping context of the same type of API client as the created context and is not EGL_NO_CONTEXT.
This is why I added to the parameter EGL_CONTEXT_CLIENT_VERSION, but it seems to have done nothing.
What I see is that although I am getting this error, the context seems to be semi-valid. I can use it in another thread
egl.eglMakeCurrent(display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, context);
. , , , , .
, . , eglMakeCurrent,
E/AndroidRuntime(3210): java.lang.IllegalArgumentException
E/AndroidRuntime(3210): at com.google.android.gles_jni.EGLImpl._eglCreateContext(Native Method)
E/AndroidRuntime(3210): at com.google.android.gles_jni.EGLImpl.eglCreateContext(EGLImpl.java:54)
, , - , ?