Java Code Examples for javax.microedition.khronos.egl.EGL10#eglGetConfigs()

The following examples show how to use javax.microedition.khronos.egl.EGL10#eglGetConfigs() . 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: BitmapUtil.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public static int getMaxTextureSize() {
  final int MAX_ALLOWED_TEXTURE_SIZE = 2048;

  EGL10 egl = (EGL10) EGLContext.getEGL();
  EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  int[] version = new int[2];
  egl.eglInitialize(display, version);

  int[] totalConfigurations = new int[1];
  egl.eglGetConfigs(display, null, 0, totalConfigurations);

  EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
  egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

  int[] textureSize = new int[1];
  int maximumTextureSize = 0;

  for (int i = 0; i < totalConfigurations[0]; i++) {
    egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

    if (maximumTextureSize < textureSize[0])
      maximumTextureSize = textureSize[0];
  }

  egl.eglTerminate(display);

  return Math.min(maximumTextureSize, MAX_ALLOWED_TEXTURE_SIZE);
}
 
Example 2
Source File: Utils.java    From react-native-documentscanner-android with MIT License 5 votes vote down vote up
public static int getMaxTextureSize() {
    // Safe minimum default size
    final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

    // Get EGL Display
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++) {
        // Only need to check for width since opengl textures are always squared
        egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

        // Keep track of the maximum texture size
        if (maximumTextureSize < textureSize[0])
            maximumTextureSize = textureSize[0];
    }

    // Release
    egl.eglTerminate(display);

    // Return largest texture size found, or default
    return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
 
Example 3
Source File: TextureSizeUtils.java    From Moment with GNU General Public License v3.0 5 votes vote down vote up
public static int getMaxTextureSize() {
    // Safe minimum default size
    final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

    // Get EGL Display
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++) {
        // Only need to check for width since opengl textures are always squared
        egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

        // Keep track of the maximum texture size
        if (maximumTextureSize < textureSize[0])
            maximumTextureSize = textureSize[0];
    }

    // Release
    egl.eglTerminate(display);

    // Return largest texture size found, or default
    return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
 
Example 4
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 5
Source File: Utils.java    From Document-Scanner with GNU General Public License v3.0 5 votes vote down vote up
public static int getMaxTextureSize() {
    // Safe minimum default size
    final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

    // Get EGL Display
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++) {
        // Only need to check for width since opengl textures are always squared
        egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

        // Keep track of the maximum texture size
        if (maximumTextureSize < textureSize[0])
            maximumTextureSize = textureSize[0];
    }

    // Release
    egl.eglTerminate(display);

    // Return largest texture size found, or default
    return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
 
Example 6
Source File: BitmapUtil.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
public static int getMaxTextureSize() {
  final int MAX_ALLOWED_TEXTURE_SIZE = 2048;

  EGL10 egl = (EGL10) EGLContext.getEGL();
  EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  int[] version = new int[2];
  egl.eglInitialize(display, version);

  int[] totalConfigurations = new int[1];
  egl.eglGetConfigs(display, null, 0, totalConfigurations);

  EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
  egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

  int[] textureSize = new int[1];
  int maximumTextureSize = 0;

  for (int i = 0; i < totalConfigurations[0]; i++) {
    egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

    if (maximumTextureSize < textureSize[0])
      maximumTextureSize = textureSize[0];
  }

  egl.eglTerminate(display);

  return Math.min(maximumTextureSize, MAX_ALLOWED_TEXTURE_SIZE);
}
 
Example 7
Source File: BitmapUtil.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
public static int getMaxTextureSize() {
  final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

  EGL10 egl = (EGL10) EGLContext.getEGL();
  EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  int[] version = new int[2];
  egl.eglInitialize(display, version);

  int[] totalConfigurations = new int[1];
  egl.eglGetConfigs(display, null, 0, totalConfigurations);

  EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
  egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

  int[] textureSize = new int[1];
  int maximumTextureSize = 0;

  for (int i = 0; i < totalConfigurations[0]; i++) {
    egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

    if (maximumTextureSize < textureSize[0])
      maximumTextureSize = textureSize[0];
  }

  egl.eglTerminate(display);

  return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
 
Example 8
Source File: ImgHelper.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
public static int getMaxTextureSize() {
    // Safe minimum default size
    final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

    // Get EGL Display
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++) {
        // Only need to check for width since opengl textures are always squared
        egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

        // Keep track of the maximum texture size
        if (maximumTextureSize < textureSize[0])
            maximumTextureSize = textureSize[0];
    }

    // Release
    egl.eglTerminate(display);

    // Return largest texture size found, or default
    return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
 
Example 9
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);
    }
}
 
Example 10
Source File: BitmapUtils.java    From Lassi-Android with MIT License 4 votes vote down vote up
/**
 * Get the max size of bitmap allowed to be rendered on the device.<br>
 * http://stackoverflow.com/questions/7428996/hw-accelerated-activity-how-to-get-opengl-texture-size-limit.
 */
private static int getMaxTextureSize() {
    // Safe minimum default size
    final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

    try {
        // Get EGL Display
        EGL10 egl = (EGL10) EGLContext.getEGL();
        EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

        // Initialise
        int[] version = new int[2];
        egl.eglInitialize(display, version);

        // Query total number of configurations
        int[] totalConfigurations = new int[1];
        egl.eglGetConfigs(display, null, 0, totalConfigurations);

        // Query actual list configurations
        EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
        egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

        int[] textureSize = new int[1];
        int maximumTextureSize = 0;

        // Iterate through all the configurations to located the maximum texture size
        for (int i = 0; i < totalConfigurations[0]; i++) {
            // Only need to check for width since opengl textures are always squared
            egl.eglGetConfigAttrib(
                    display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

            // Keep track of the maximum texture size
            if (maximumTextureSize < textureSize[0]) {
                maximumTextureSize = textureSize[0];
            }
        }

        // Release
        egl.eglTerminate(display);

        // Return largest texture size found, or default
        return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
    } catch (Exception e) {
        Logger.INSTANCE.e(logTag, "getMaxTextureSize >> " + e);
        return IMAGE_MAX_BITMAP_DIMENSION;

    }
}
 
Example 11
Source File: BitmapUtils.java    From giffun with Apache License 2.0 4 votes vote down vote up
/**
 * Get the max size of bitmap allowed to be rendered on the device.<br>
 * http://stackoverflow.com/questions/7428996/hw-accelerated-activity-how-to-get-opengl-texture-size-limit.
 */
private static int getMaxTextureSize() {
  // Safe minimum default size
  final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

  try {
    // Get EGL Display
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++) {
      // Only need to check for width since opengl textures are always squared
      egl.eglGetConfigAttrib(
          display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

      // Keep track of the maximum texture size
      if (maximumTextureSize < textureSize[0]) {
        maximumTextureSize = textureSize[0];
      }
    }

    // Release
    egl.eglTerminate(display);

    // Return largest texture size found, or default
    return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
  } catch (Exception e) {
    return IMAGE_MAX_BITMAP_DIMENSION;
  }
}
 
Example 12
Source File: ActivityManagerShellCommand.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
Set<String> getGlExtensionsFromDriver() {
    Set<String> glExtensions = new HashSet<>();

    // Get the EGL implementation.
    EGL10 egl = (EGL10) EGLContext.getEGL();
    if (egl == null) {
        getErrPrintWriter().println("Warning: couldn't get EGL");
        return glExtensions;
    }

    // Get the default display and initialize it.
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Call getConfigs() in order to find out how many there are.
    int[] numConfigs = new int[1];
    if (!egl.eglGetConfigs(display, null, 0, numConfigs)) {
        getErrPrintWriter().println("Warning: couldn't get EGL config count");
        return glExtensions;
    }

    // Allocate space for all configs and ask again.
    EGLConfig[] configs = new EGLConfig[numConfigs[0]];
    if (!egl.eglGetConfigs(display, configs, numConfigs[0], numConfigs)) {
        getErrPrintWriter().println("Warning: couldn't get EGL configs");
        return glExtensions;
    }

    // Allocate surface size parameters outside of the main loop to cut down
    // on GC thrashing.  1x1 is enough since we are only using it to get at
    // the list of extensions.
    int[] surfaceSize =
            new int[] {
                    EGL10.EGL_WIDTH, 1,
                    EGL10.EGL_HEIGHT, 1,
                    EGL10.EGL_NONE
            };

    // For when we need to create a GLES2.0 context.
    final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
    int[] gles2 = new int[] {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};

    // For getting return values from eglGetConfigAttrib
    int[] attrib = new int[1];

    for (int i = 0; i < numConfigs[0]; i++) {
        // Get caveat for this config in order to skip slow (i.e. software) configs.
        egl.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_CAVEAT, attrib);
        if (attrib[0] == EGL10.EGL_SLOW_CONFIG) {
            continue;
        }

        // If the config does not support pbuffers we cannot do an eglMakeCurrent
        // on it in addExtensionsForConfig(), so skip it here. Attempting to make
        // it current with a pbuffer will result in an EGL_BAD_MATCH error
        egl.eglGetConfigAttrib(display, configs[i], EGL10.EGL_SURFACE_TYPE, attrib);
        if ((attrib[0] & EGL10.EGL_PBUFFER_BIT) == 0) {
            continue;
        }

        final int EGL_OPENGL_ES_BIT = 0x0001;
        final int EGL_OPENGL_ES2_BIT = 0x0004;
        egl.eglGetConfigAttrib(display, configs[i], EGL10.EGL_RENDERABLE_TYPE, attrib);
        if ((attrib[0] & EGL_OPENGL_ES_BIT) != 0) {
            addExtensionsForConfig(egl, display, configs[i], surfaceSize, null, glExtensions);
        }
        if ((attrib[0] & EGL_OPENGL_ES2_BIT) != 0) {
            addExtensionsForConfig(egl, display, configs[i], surfaceSize, gles2, glExtensions);
        }
    }

    // Release all EGL resources.
    egl.eglTerminate(display);

    return glExtensions;
}
 
Example 13
Source File: BitmapUtils.java    From timecat with Apache License 2.0 4 votes vote down vote up
/**
 * Get the max size of bitmap allowed to be rendered on the device.<br>
 * http://stackoverflow.com/questions/7428996/hw-accelerated-activity-how-to-get-opengl-texture-size-limit.
 */
private static int getMaxTextureSize() {
    // Safe minimum default size
    final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

    try {
        // Get EGL Display
        EGL10 egl = (EGL10) EGLContext.getEGL();
        EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

        // Initialise
        int[] version = new int[2];
        egl.eglInitialize(display, version);

        // Query total number of configurations
        int[] totalConfigurations = new int[1];
        egl.eglGetConfigs(display, null, 0, totalConfigurations);

        // Query actual list configurations
        EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
        egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

        int[] textureSize = new int[1];
        int maximumTextureSize = 0;

        // Iterate through all the configurations to located the maximum texture size
        for (int i = 0; i < totalConfigurations[0]; i++) {
            // Only need to check for width since opengl textures are always squared
            egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

            // Keep track of the maximum texture size
            if (maximumTextureSize < textureSize[0]) {
                maximumTextureSize = textureSize[0];
            }
        }

        // Release
        egl.eglTerminate(display);

        // Return largest texture size found, or default
        return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
    } catch (Exception e) {
        return IMAGE_MAX_BITMAP_DIMENSION;
    }
}
 
Example 14
Source File: BitmapUtils.java    From Android-Image-Cropper with Apache License 2.0 4 votes vote down vote up
/**
 * Get the max size of bitmap allowed to be rendered on the device.<br>
 * http://stackoverflow.com/questions/7428996/hw-accelerated-activity-how-to-get-opengl-texture-size-limit.
 */
private static int getMaxTextureSize() {
  // Safe minimum default size
  final int IMAGE_MAX_BITMAP_DIMENSION = 2048;

  try {
    // Get EGL Display
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);

    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);

    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);

    int[] textureSize = new int[1];
    int maximumTextureSize = 0;

    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++) {
      // Only need to check for width since opengl textures are always squared
      egl.eglGetConfigAttrib(
          display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);

      // Keep track of the maximum texture size
      if (maximumTextureSize < textureSize[0]) {
        maximumTextureSize = textureSize[0];
      }
    }

    // Release
    egl.eglTerminate(display);

    // Return largest texture size found, or default
    return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
  } catch (Exception e) {
    return IMAGE_MAX_BITMAP_DIMENSION;
  }
}