From 5a714236241f4e72b83c23768328f1cdd9d618a7 Mon Sep 17 00:00:00 2001 From: "iwg..ic" Date: Tue, 11 Sep 2012 01:07:25 +0000 Subject: [PATCH] Fix issue with BEST config not choosing a valid config on some devices when RGBA is not matched (ie no config exists with 0bit alpha). ConfigChooser now looks for an exact match of all attributes first, then a match of RGBA only, then uses the first available config. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9715 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../system/android/AndroidConfigChooser.java | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/engine/src/android/com/jme3/system/android/AndroidConfigChooser.java b/engine/src/android/com/jme3/system/android/AndroidConfigChooser.java index 91ed2b6c6..d7d225324 100644 --- a/engine/src/android/com/jme3/system/android/AndroidConfigChooser.java +++ b/engine/src/android/com/jme3/system/android/AndroidConfigChooser.java @@ -2,7 +2,6 @@ package com.jme3.system.android; import android.graphics.PixelFormat; import android.opengl.GLSurfaceView.EGLConfigChooser; -import java.util.logging.Level; import java.util.logging.Logger; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; @@ -116,7 +115,7 @@ public class AndroidConfigChooser implements EGLConfigChooser { //Android Pixel format is not very well documented. //From what i gathered, the format is chosen automatically except for the alpha channel //if the alpha channel has 8 bit or more, e set the pixel format to Transluscent, as it allow transparent view background - //if it's 0 bit, the format is OPAQUE otherwise it's TRANSPARENT + //if it's 0 bit, the format is OPAQUE otherwise it's TRANSPARENT egl.eglGetConfigAttrib(display, conf, EGL10.EGL_ALPHA_SIZE, value); if (value[0] >= 8) { return PixelFormat.TRANSLUCENT; @@ -217,6 +216,19 @@ public class AndroidConfigChooser implements EGLConfigChooser { num_config)) { throw new IllegalArgumentException("eglChooseConfig#2 failed"); } +// logger.log(Level.INFO, "num_config: {0}", num_config[0]); +// +// logger.log(Level.INFO, "There are {0} configurations that match the configAttrs", num_config[0]); +// logger.log(Level.INFO, "All Matching Configs:"); +// for (int i=0; i 0) { + return configs[0]; + } else { + return null; + } + } private int findConfigAttrib(EGL10 egl, EGLDisplay display,