Java Code Examples for android.opengl.EGLExt#EGL_OPENGL_ES3_BIT_KHR

The following examples show how to use android.opengl.EGLExt#EGL_OPENGL_ES3_BIT_KHR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLTextureView.java    From PhotoMovie with Apache License 2.0 6 votes vote down vote up
private int[] filterConfigSpec(int[] configSpec) {
    if (mEGLContextClientVersion != 2 && mEGLContextClientVersion != 3) {
        return configSpec;
    }
    /* We know none of the subclasses define EGL_RENDERABLE_TYPE.
     * And we know the configSpec is well formed.
     */
    int len = configSpec.length;
    int[] newConfigSpec = new int[len + 2];
    System.arraycopy(configSpec, 0, newConfigSpec, 0, len - 1);
    newConfigSpec[len - 1] = EGL10.EGL_RENDERABLE_TYPE;
    if (mEGLContextClientVersion == 2) {
        newConfigSpec[len] = EGL14.EGL_OPENGL_ES2_BIT;  /* EGL_OPENGL_ES2_BIT */
    } else {
        newConfigSpec[len] = EGLExt.EGL_OPENGL_ES3_BIT_KHR; /* EGL_OPENGL_ES3_BIT_KHR */
    }
    newConfigSpec[len + 1] = EGL10.EGL_NONE;
    return newConfigSpec;
}
 
Example 2
Source File: GLTextureView.java    From EZFilter with MIT License 6 votes vote down vote up
private int[] filterConfigSpec(int[] configSpec) {
    if (mEGLContextClientVersion != 2 && mEGLContextClientVersion != 3) {
        return configSpec;
    }
    /* We know none of the subclasses define EGL_RENDERABLE_TYPE.
     * And we know the configSpec is well formed.
     */
    int len = configSpec.length;
    int[] newConfigSpec = new int[len + 2];
    System.arraycopy(configSpec, 0, newConfigSpec, 0, len - 1);
    newConfigSpec[len - 1] = EGL10.EGL_RENDERABLE_TYPE;
    if (mEGLContextClientVersion == 2) {
        newConfigSpec[len] = EGL14.EGL_OPENGL_ES2_BIT;  /* EGL_OPENGL_ES2_BIT */
    } else {
        newConfigSpec[len] = EGLExt.EGL_OPENGL_ES3_BIT_KHR; /* EGL_OPENGL_ES3_BIT_KHR */
    }
    newConfigSpec[len + 1] = EGL10.EGL_NONE;
    return newConfigSpec;
}
 
Example 3
Source File: GLThread.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
private int[] filterConfigSpec(int[] configSpec) {
    if (contextClientVersion != 2 && contextClientVersion != 3) {
        return configSpec;
    }
    /* We know none of the subclasses define EGL_RENDERABLE_TYPE.
     * And we know the configSpec is well formed.
     */
    int len = configSpec.length;
    int[] newConfigSpec = new int[len + 2];
    System.arraycopy(configSpec, 0, newConfigSpec, 0, len - 1);
    newConfigSpec[len - 1] = EGL10.EGL_RENDERABLE_TYPE;
    if (contextClientVersion == 2) {
        newConfigSpec[len] = EGL14.EGL_OPENGL_ES2_BIT;  /* EGL_OPENGL_ES2_BIT */
    } else {
        newConfigSpec[len] = EGLExt.EGL_OPENGL_ES3_BIT_KHR; /* EGL_OPENGL_ES3_BIT_KHR */
    }
    newConfigSpec[len + 1] = EGL10.EGL_NONE;
    return newConfigSpec;
}
 
Example 4
Source File: GLThread.java    From android-openGL-canvas with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public android.opengl.EGLConfig chooseConfig(android.opengl.EGLDisplay display, boolean recordable) {
    int renderableType = EGL14.EGL_OPENGL_ES2_BIT;
    if (contextClientVersion >= 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 (recordable) {
        attribList[attribList.length - 3] = EGL_RECORDABLE_ANDROID;
        attribList[attribList.length - 2] = 1;
    }
    android.opengl.EGLConfig[] configs = new android.opengl.EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(display, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        Log.w("GLThread", "unable to find RGB8888 / " + contextClientVersion + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 5
Source File: EglCore.java    From VIA-AI with MIT License 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 6
Source File: EglCore.java    From cineio-broadcast-android with MIT License 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags   Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 7
Source File: EglCore.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 8
Source File: EglCore.java    From FuAgoraDemoDroid with MIT License 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags   Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 9
Source File: EglCore.java    From MockCamera with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags   Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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(eGLDisplay, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        Log.w(TAG, "unable to find RGB8888 / " + version + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 10
Source File: EglCore.java    From AndroidPlayground with MIT License 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 11
Source File: EglCore.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags   Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 12
Source File: GLThread.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public android.opengl.EGLConfig chooseConfig(android.opengl.EGLDisplay display, boolean recordable) {
    int renderableType = EGL14.EGL_OPENGL_ES2_BIT;
    if (contextClientVersion >= 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 (recordable) {
        attribList[attribList.length - 3] = EGL_RECORDABLE_ANDROID;
        attribList[attribList.length - 2] = 1;
    }
    android.opengl.EGLConfig[] configs = new android.opengl.EGLConfig[1];
    int[] numConfigs = new int[1];
    if (!EGL14.eglChooseConfig(display, attribList, 0, configs, 0, configs.length,
            numConfigs, 0)) {
        Log.w("GLThread", "unable to find RGB8888 / " + contextClientVersion + " EGLConfig");
        return null;
    }
    return configs[0];
}
 
Example 13
Source File: EglUtil.java    From SimpleVideoEditor with Apache License 2.0 5 votes vote down vote up
static EGLConfig getEglConfig(EGLDisplay eglDisplay, int version) {
    // Get an EGLConfig.
    int renderableType = EGL14.EGL_OPENGL_ES2_BIT;
    if (version == 3) {
        renderableType = EGLExt.EGL_OPENGL_ES3_BIT_KHR;
    }
    final int RED_SIZE = 8;
    final int GREEN_SIZE = 8;
    final int BLUE_SIZE = 8;
    final int ALPHA_SIZE = 8;
    final int DEPTH_SIZE = 0;
    final int STENCIL_SIZE = 0;
    final int[] DEFAULT_CONFIGURATION = new int[]{
            EGL14.EGL_RENDERABLE_TYPE, renderableType,
            EGL14.EGL_RED_SIZE, RED_SIZE,
            EGL14.EGL_GREEN_SIZE, GREEN_SIZE,
            EGL14.EGL_BLUE_SIZE, BLUE_SIZE,
            EGL14.EGL_ALPHA_SIZE, ALPHA_SIZE,
            EGL14.EGL_DEPTH_SIZE, DEPTH_SIZE,
            EGL14.EGL_STENCIL_SIZE, STENCIL_SIZE,
            EGL14.EGL_NONE};
    int[] configsCount = new int[1];
    EGLConfig[] eglConfigs = new EGLConfig[1];
    if (!EGL14.eglChooseConfig(
            eglDisplay, DEFAULT_CONFIGURATION, 0, eglConfigs, 0, 1, configsCount, 0)) {
        throw new RuntimeException("eglChooseConfig failed");
    }
    return eglConfigs[0];
}
 
Example 14
Source File: EglCore.java    From sealrtc-android with MIT License 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 15
Source File: EglCore.java    From IjkVRPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 16
Source File: EglCore.java    From TikTok with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 17
Source File: EglCore.java    From PhotoMovie with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 18
Source File: EglCore.java    From RtmpPublisher with Apache License 2.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 19
Source File: EglCore.java    From mobile-ar-sensor-logger with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}
 
Example 20
Source File: EglCore.java    From Lassi-Android with MIT License 5 votes vote down vote up
/**
 * Finds a suitable EGLConfig.
 *
 * @param flags   Bit flags from constructor.
 * @param version Must be 2 or 3.
 */
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];
}