androidopengl-es

how to use EGL_KHR_no_config_context


my android supports EGL_KHR_no_config_context but running this throws an exception

EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
int[] version = new int[2];
EGL14.eglInitialize(display, version,0, version,0);
int[] attrib_list = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 3, EGL14.EGL_NONE };
EGL14.eglCreateContext(display, null, EGL14.EGL_NO_CONTEXT, attrib_list,0);

notice null instead of config
and the exception is

JNI DETECTED ERROR IN APPLICATION: JNI CallLongMethodV called with pending exception java.lang.IllegalArgumentException: Object is set to null.
at android.opengl.EGLContext android.opengl.EGL14.eglCreateContext(android.opengl.EGLDisplay, android.opengl.EGLConfig, android.opengl.EGLContext, int[], int) (EGL14.java:-2)

what is the correct way of using EGL_KHR_no_config_context


Solution

  • The JNI bindings don't support no-config context creation. This extension is only supported if you call EGL directly from native code.

    Current Android JNI implementation always tries to retrieve a valid object handle and throws the exception in this function here: