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

The following examples show how to use javax.microedition.khronos.egl.EGL10#eglGetConfigAttrib() . 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: ViEAndroidGLES20.java    From LiveVideo with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {

			if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
				return mValue[0];
			}
			return defaultValue;
		}
 
Example 2
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 3
Source File: AndroidConfigChooser.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
        EGLConfig config, int attribute, int defaultValue) 
{

    if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) 
    {
        return mValue[0];
    }
    return defaultValue;
}
 
Example 4
Source File: EGL.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {

      if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
      }
      return defaultValue;
    }
 
Example 5
Source File: AndroidConfigChooser.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * log output with egl config details
 * @param conf
 * @param display
 * @param egl
 */
public void logEGLConfig(EGLConfig conf, EGLDisplay display, EGL10 egl)
{
    int[] value = new int[1];

    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RED_SIZE, value);
    logger.info(String.format("EGL_RED_SIZE  = %d", value[0] ) );
    
    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_GREEN_SIZE, value);
    logger.info(String.format("EGL_GREEN_SIZE  = %d", value[0] ) );
    
    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_BLUE_SIZE, value);
    logger.info(String.format("EGL_BLUE_SIZE  = %d", value[0] ) );
    
    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_ALPHA_SIZE, value);
    logger.info(String.format("EGL_ALPHA_SIZE  = %d", value[0] ) );
    
    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_DEPTH_SIZE, value);
    logger.info(String.format("EGL_DEPTH_SIZE  = %d", value[0] ) );
            
    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_STENCIL_SIZE, value);
    logger.info(String.format("EGL_STENCIL_SIZE  = %d", value[0] ) );

    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RENDERABLE_TYPE, value);
    logger.info(String.format("EGL_RENDERABLE_TYPE  = %d", value[0] ) );
    
    egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SURFACE_TYPE, value);
    logger.info(String.format("EGL_SURFACE_TYPE  = %d", value[0] ) );               
}
 
Example 6
Source File: ViEAndroidGLES20.java    From LiveVideo with Apache License 2.0 5 votes vote down vote up
private void printConfig(EGL10 egl, EGLDisplay display, EGLConfig config) {
	int[] attributes = { EGL10.EGL_BUFFER_SIZE, EGL10.EGL_ALPHA_SIZE, EGL10.EGL_BLUE_SIZE, EGL10.EGL_GREEN_SIZE, EGL10.EGL_RED_SIZE,
			EGL10.EGL_DEPTH_SIZE, EGL10.EGL_STENCIL_SIZE, EGL10.EGL_CONFIG_CAVEAT, EGL10.EGL_CONFIG_ID, EGL10.EGL_LEVEL, EGL10.EGL_MAX_PBUFFER_HEIGHT,
			EGL10.EGL_MAX_PBUFFER_PIXELS, EGL10.EGL_MAX_PBUFFER_WIDTH, EGL10.EGL_NATIVE_RENDERABLE, EGL10.EGL_NATIVE_VISUAL_ID,
			EGL10.EGL_NATIVE_VISUAL_TYPE,
			0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
			EGL10.EGL_SAMPLES, EGL10.EGL_SAMPLE_BUFFERS, EGL10.EGL_SURFACE_TYPE, EGL10.EGL_TRANSPARENT_TYPE, EGL10.EGL_TRANSPARENT_RED_VALUE,
			EGL10.EGL_TRANSPARENT_GREEN_VALUE, EGL10.EGL_TRANSPARENT_BLUE_VALUE, 0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
			0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
			0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
			0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
			EGL10.EGL_LUMINANCE_SIZE, EGL10.EGL_ALPHA_MASK_SIZE, EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RENDERABLE_TYPE, 0x3042 // EGL10.EGL_CONFORMANT
	};
	String[] names = { "EGL_BUFFER_SIZE", "EGL_ALPHA_SIZE", "EGL_BLUE_SIZE", "EGL_GREEN_SIZE", "EGL_RED_SIZE", "EGL_DEPTH_SIZE", "EGL_STENCIL_SIZE",
			"EGL_CONFIG_CAVEAT", "EGL_CONFIG_ID", "EGL_LEVEL", "EGL_MAX_PBUFFER_HEIGHT", "EGL_MAX_PBUFFER_PIXELS", "EGL_MAX_PBUFFER_WIDTH",
			"EGL_NATIVE_RENDERABLE", "EGL_NATIVE_VISUAL_ID", "EGL_NATIVE_VISUAL_TYPE", "EGL_PRESERVED_RESOURCES", "EGL_SAMPLES", "EGL_SAMPLE_BUFFERS",
			"EGL_SURFACE_TYPE", "EGL_TRANSPARENT_TYPE", "EGL_TRANSPARENT_RED_VALUE", "EGL_TRANSPARENT_GREEN_VALUE", "EGL_TRANSPARENT_BLUE_VALUE",
			"EGL_BIND_TO_TEXTURE_RGB", "EGL_BIND_TO_TEXTURE_RGBA", "EGL_MIN_SWAP_INTERVAL", "EGL_MAX_SWAP_INTERVAL", "EGL_LUMINANCE_SIZE",
			"EGL_ALPHA_MASK_SIZE", "EGL_COLOR_BUFFER_TYPE", "EGL_RENDERABLE_TYPE", "EGL_CONFORMANT" };
	int[] value = new int[1];
	for (int i = 0; i < attributes.length; i++) {
		int attribute = attributes[i];
		String name = names[i];
		if (egl.eglGetConfigAttrib(display, config, attribute, value)) {
			Log.w(TAG, String.format("  %s: %d\n", name, value[0]));
		} else {
			Log.w(TAG, String.format("  %s: failed\n", name));
			while (egl.eglGetError() != EGL10.EGL_SUCCESS)
				;
		}
	}
}
 
Example 7
Source File: EGL.java    From BambooPlayer with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {

      if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
      }
      return defaultValue;
    }
 
Example 8
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 9
Source File: EGL.java    From react-native-android-vitamio with MIT License 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {

      if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
      }
      return defaultValue;
    }
 
Example 10
Source File: EGL.java    From Vitamio with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {

      if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
      }
      return defaultValue;
    }
 
Example 11
Source File: ViEAndroidGLES20.java    From webrtc-app-mono with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
        EGLConfig config, int attribute, int defaultValue) {

    if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
    }
    return defaultValue;
}
 
Example 12
Source File: EGL.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) {

      if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
      }
      return defaultValue;
    }
 
Example 13
Source File: GLTextureView.java    From PhotoMovie with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
                             EGLConfig config, int attribute, int defaultValue) {

    if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
    }
    return defaultValue;
}
 
Example 14
Source File: GLTextureView.java    From ZGDanmaku with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
                             EGLConfig config, int attribute, int defaultValue) {

    if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
    }
    return defaultValue;
}
 
Example 15
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 16
Source File: GLTextureView.java    From android-RoundedTextureView with Apache License 2.0 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute,
    int defaultValue) {

  if (egl.eglGetConfigAttrib(display, config, attribute, value)) {
    return value[0];
  }
  return defaultValue;
}
 
Example 17
Source File: GLTextureView.java    From EZFilter with MIT License 5 votes vote down vote up
private int findConfigAttrib(EGL10 egl, EGLDisplay display,
                             EGLConfig config, int attribute, int defaultValue) {

    if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
        return mValue[0];
    }
    return defaultValue;
}
 
Example 18
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 19
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 20
Source File: VideoView.java    From NewsMe with Apache License 2.0 4 votes vote down vote up
private void printConfig(EGL10 egl, EGLDisplay display, EGLConfig config) {
	int[] attributes = { EGL10.EGL_BUFFER_SIZE, EGL10.EGL_ALPHA_SIZE,
			EGL10.EGL_BLUE_SIZE,
			EGL10.EGL_GREEN_SIZE,
			EGL10.EGL_RED_SIZE,
			EGL10.EGL_DEPTH_SIZE,
			EGL10.EGL_STENCIL_SIZE,
			EGL10.EGL_CONFIG_CAVEAT,
			EGL10.EGL_CONFIG_ID,
			EGL10.EGL_LEVEL,
			EGL10.EGL_MAX_PBUFFER_HEIGHT,
			EGL10.EGL_MAX_PBUFFER_PIXELS,
			EGL10.EGL_MAX_PBUFFER_WIDTH,
			EGL10.EGL_NATIVE_RENDERABLE,
			EGL10.EGL_NATIVE_VISUAL_ID,
			EGL10.EGL_NATIVE_VISUAL_TYPE,
			0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
			EGL10.EGL_SAMPLES,
			EGL10.EGL_SAMPLE_BUFFERS,
			EGL10.EGL_SURFACE_TYPE,
			EGL10.EGL_TRANSPARENT_TYPE,
			EGL10.EGL_TRANSPARENT_RED_VALUE,
			EGL10.EGL_TRANSPARENT_GREEN_VALUE,
			EGL10.EGL_TRANSPARENT_BLUE_VALUE,
			0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
			0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
			0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
			0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
			EGL10.EGL_LUMINANCE_SIZE, EGL10.EGL_ALPHA_MASK_SIZE,
			EGL10.EGL_COLOR_BUFFER_TYPE, EGL10.EGL_RENDERABLE_TYPE,
			0x3042 // EGL10.EGL_CONFORMANT
	};
	String[] names = { "EGL_BUFFER_SIZE", "EGL_ALPHA_SIZE",
			"EGL_BLUE_SIZE", "EGL_GREEN_SIZE", "EGL_RED_SIZE",
			"EGL_DEPTH_SIZE", "EGL_STENCIL_SIZE", "EGL_CONFIG_CAVEAT",
			"EGL_CONFIG_ID", "EGL_LEVEL", "EGL_MAX_PBUFFER_HEIGHT",
			"EGL_MAX_PBUFFER_PIXELS", "EGL_MAX_PBUFFER_WIDTH",
			"EGL_NATIVE_RENDERABLE", "EGL_NATIVE_VISUAL_ID",
			"EGL_NATIVE_VISUAL_TYPE", "EGL_PRESERVED_RESOURCES",
			"EGL_SAMPLES", "EGL_SAMPLE_BUFFERS", "EGL_SURFACE_TYPE",
			"EGL_TRANSPARENT_TYPE", "EGL_TRANSPARENT_RED_VALUE",
			"EGL_TRANSPARENT_GREEN_VALUE",
			"EGL_TRANSPARENT_BLUE_VALUE", "EGL_BIND_TO_TEXTURE_RGB",
			"EGL_BIND_TO_TEXTURE_RGBA", "EGL_MIN_SWAP_INTERVAL",
			"EGL_MAX_SWAP_INTERVAL", "EGL_LUMINANCE_SIZE",
			"EGL_ALPHA_MASK_SIZE", "EGL_COLOR_BUFFER_TYPE",
			"EGL_RENDERABLE_TYPE", "EGL_CONFORMANT" };
	int[] value = new int[1];
	for (int i = 0; i < attributes.length; i++) {
		int attribute = attributes[i];
		String name = names[i];
		if (egl.eglGetConfigAttrib(display, config, attribute, value)) {
			LogS.d(TAG, String.format("  %s: %d\n", name, value[0]));
		} else {
			// Log.w(TAG, String.format("  %s: failed\n", name));
			while (egl.eglGetError() != EGL10.EGL_SUCCESS)
				;
		}
	}
}