List of usage examples for javax.microedition.khronos.egl EGL10 eglGetConfigAttrib
boolean eglGetConfigAttrib(EGLDisplay display, EGLConfig config, int attribute, int[] value);
From source file:Main.java
/** * Calls getEGLConfigAttrib and returns the value for the specified attribute. * @param egl//w w w . j a va 2s . c om * @param eglDisplay * @param config * @param configAttrib * @return */ public static int getEGLConfigAttrib(EGL10 egl, EGLDisplay eglDisplay, EGLConfig config, int configAttrib) { int[] attribs = new int[1]; egl.eglGetConfigAttrib(eglDisplay, config, configAttrib, attribs); return attribs[0]; }
From source file:Main.java
/** * Wrapper for EGL10.eglGetConfigAttrib() with a fallback value just * in case the function fails./*from ww w . j a v a 2 s . co m*/ */ static int getConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) { int[] mValue = new int[1]; return egl.eglGetConfigAttrib(display, config, attribute, mValue) ? mValue[0] : defaultValue; }
From source file:Main.java
public static int getMaximumTextureSize() { 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]; }/* www.j av a2 s . com*/ } egl.eglTerminate(display); return maximumTextureSize; }
From source file:Main.java
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]; }//from ww w . j a v a 2 s. co m // Release egl.eglTerminate(display); // Return largest texture size found, or default return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION); }
From source file:Main.java
/** * 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. *//*from w w w . jav a 2 s. c o m*/ 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; } }