Java Code Examples for javax.microedition.khronos.egl.EGL10#EGL_PIXMAP_BIT

The following examples show how to use javax.microedition.khronos.egl.EGL10#EGL_PIXMAP_BIT . 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: EglExtensionRetriever.java    From YalpStore with GNU General Public License v2.0 5 votes vote down vote up
public static List<String> getEglExtensions() {
    Set<String> glExtensions = new HashSet<>();
    EGL10 egl10 = (EGL10) EGLContext.getEGL();
    if (egl10 == null) {
        return new ArrayList<>();
    }
    EGLDisplay display = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    egl10.eglInitialize(display, new int[2]);
    int cf[] = new int[1];
    if (egl10.eglGetConfigs(display, null, 0, cf)) {
        EGLConfig[] configs = new EGLConfig[cf[0]];
        if (egl10.eglGetConfigs(display, configs, cf[0], cf)) {
            int[] a1 = new int[] {EGL10.EGL_WIDTH, EGL10.EGL_PBUFFER_BIT, EGL10.EGL_HEIGHT, EGL10.EGL_PBUFFER_BIT, EGL10.EGL_NONE};
            int[] a2 = new int[] {12440, EGL10.EGL_PIXMAP_BIT, EGL10.EGL_NONE};
            int[] a3 = new int[1];
            for (int i = 0; i < cf[0]; i++) {
                egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_CAVEAT, a3);
                if (a3[0] != EGL10.EGL_SLOW_CONFIG) {
                    egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_SURFACE_TYPE, a3);
                    if ((1 & a3[0]) != 0) {
                        egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_RENDERABLE_TYPE, a3);
                        if ((1 & a3[0]) != 0) {
                            addExtensionsForConfig(egl10, display, configs[i], a1, null, glExtensions);
                        }
                        if ((4 & a3[0]) != 0) {
                            addExtensionsForConfig(egl10, display, configs[i], a1, a2, glExtensions);
                        }
                    }
                }
            }
        }
    }
    egl10.eglTerminate(display);
    List<String> sorted = new ArrayList<>(glExtensions);
    Collections.sort(sorted);
    return sorted;
}
 
Example 2
Source File: DeviceConfiguration.java    From android_packages_apps_GmsCore with Apache License 2.0 5 votes vote down vote up
private static void addEglExtensions(Set<String> glExtensions) {
    EGL10 egl10 = (EGL10) EGLContext.getEGL();
    if (egl10 != null) {
        EGLDisplay display = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
        egl10.eglInitialize(display, new int[2]);
        int cf[] = new int[1];
        if (egl10.eglGetConfigs(display, null, 0, cf)) {
            EGLConfig[] configs = new EGLConfig[cf[0]];
            if (egl10.eglGetConfigs(display, configs, cf[0], cf)) {
                int[] a1 =
                        new int[]{EGL10.EGL_WIDTH, EGL10.EGL_PBUFFER_BIT, EGL10.EGL_HEIGHT, EGL10.EGL_PBUFFER_BIT,
                                EGL10.EGL_NONE};
                int[] a2 = new int[]{12440, EGL10.EGL_PIXMAP_BIT, EGL10.EGL_NONE};
                int[] a3 = new int[1];
                for (int i = 0; i < cf[0]; i++) {
                    egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_CAVEAT, a3);
                    if (a3[0] != EGL10.EGL_SLOW_CONFIG) {
                        egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_SURFACE_TYPE, a3);
                        if ((1 & a3[0]) != 0) {
                            egl10.eglGetConfigAttrib(display, configs[i], EGL10.EGL_RENDERABLE_TYPE, a3);
                            if ((1 & a3[0]) != 0) {
                                addExtensionsForConfig(egl10, display, configs[i], a1, null, glExtensions);
                            }
                            if ((4 & a3[0]) != 0) {
                                addExtensionsForConfig(egl10, display, configs[i], a1, a2, glExtensions);
                            }
                        }
                    }
                }
            }
        }
        egl10.eglTerminate(display);
    }
}