private EGLConfig getConfig(int flags, int version) {
        int renderableType = EGL14.EGL_OPENGL_ES2_BIT;
        if (version >= 3) {
            renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR;
        }

        // The actual surface is generally RGBA or RGBX, so situationally omitting alpha
        // doesn't really help.  It can also lead to a huge performance hit on glReadPixels()
        // when reading into a GL_RGBA buffer.
        int[] attribList = {
                EGL14.EGL_RED_SIZE, 8,
                EGL14.EGL_GREEN_SIZE, 8,
                EGL14.EGL_BLUE_SIZE, 8,
                EGL14.EGL_ALPHA_SIZE, 8,
                //EGL14.EGL_DEPTH_SIZE, 16,
                //EGL14.EGL_STENCIL_SIZE, 8,
                EGL14.EGL_RENDERABLE_TYPE, renderableType,
                EGL14.EGL_NONE, 0,      // placeholder for recordable [@-3]
                EGL14.EGL_NONE
        };
        if ((flags & FLAG_RECORDABLE) != 0) {
            attribList[attribList.length - 3] = EGL_RECORDABLE_ANDROID;
            attribList[attribList.length - 2] = 1;
        }
        EGLConfig[] configs = new EGLConfig[1];
        int[] numConfigs = new int[1];
        if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length,
                numConfigs, 0)) {
            Log.w(TAG, "unable to find RGB8888 / " + version + " EGLConfig");
            return null;
        }
        return configs[0];
    }
private EGLConfig getConfig ( int flags , int version ) { int renderableType = EGL14 . EGL_OPENGL_ES2_BIT ; if ( version >= 3 ) { renderableType |= EGLExt . EGL_OPENGL_ES3_BIT_KHR ; } int [ ] attribList = { EGL14 . EGL_RED_SIZE , 8 , EGL14 . EGL_GREEN_SIZE , 8 , EGL14 . EGL_BLUE_SIZE , 8 , EGL14 . EGL_ALPHA_SIZE , 8 , EGL14 . EGL_RENDERABLE_TYPE , renderableType , EGL14 . EGL_NONE , 0 , EGL14 . EGL_NONE } ; if ( ( flags & FLAG_RECORDABLE ) != 0 ) { attribList [ attribList . length - 3 ] = EGL_RECORDABLE_ANDROID ; attribList [ attribList . length - 2 ] = 1 ; } EGLConfig [ ] configs = new EGLConfig [ 1 ] ; int [ ] numConfigs = new int [ 1 ] ; if ( ! EGL14 . eglChooseConfig ( mEGLDisplay , attribList , 0 , configs , 0 , configs . length , numConfigs , 0 ) ) { Log . w ( TAG , "unable to find RGB8888 / " + version + " EGLConfig" ) ; return null ; } return configs [ 0 ] ; }
Finds a suitable EGLConfig.

@param flags Bit flags from constructor.
@param version Must be 2 or 3.