Android: Updated error checking for egl config logging

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10787 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
iwg..ic 11 years ago
parent 638947623d
commit 1a94e65176
  1. 63
      engine/src/android/com/jme3/system/android/AndroidConfigChooser.java

@ -160,6 +160,17 @@ public class AndroidConfigChooser implements EGLConfigChooser {
return result; return result;
} }
private void logEGLConfigAttrib (EGLConfig conf, EGLDisplay display, EGL10 egl,
Level level, String configName, int eglConfigAttrib) {
int[] value = new int[1];
if (egl.eglGetConfigAttrib(display, conf, eglConfigAttrib, value)) {
logger.log(level, "{0} = {1}", new Object[]{configName, value[0]});
} else {
logger.log(level, "Error getting {0} = {1}",
new Object[]{configName, egl.eglGetError()});
}
}
/** /**
* log output with egl config details * log output with egl config details
* *
@ -168,37 +179,25 @@ public class AndroidConfigChooser implements EGLConfigChooser {
* @param egl * @param egl
*/ */
public void logEGLConfig(EGLConfig conf, EGLDisplay display, EGL10 egl, Level level) { public void logEGLConfig(EGLConfig conf, EGLDisplay display, EGL10 egl, Level level) {
int[] value = new int[1]; logger.log(level, "Logging EGLConfig Attributes");
logEGLConfigAttrib(conf, display, egl, level,
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RED_SIZE, value); "EGL_RED_SIZE", EGL10.EGL_RED_SIZE);
logger.log(level, String.format("EGL_RED_SIZE = %d", value[0])); logEGLConfigAttrib(conf, display, egl, level,
"EGL_GREEN_SIZE", EGL10.EGL_GREEN_SIZE);
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_GREEN_SIZE, value); logEGLConfigAttrib(conf, display, egl, level,
logger.log(level, String.format("EGL_GREEN_SIZE = %d", value[0])); "EGL_BLUE_SIZE", EGL10.EGL_BLUE_SIZE);
logEGLConfigAttrib(conf, display, egl, level,
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_BLUE_SIZE, value); "EGL_ALPHA_SIZE", EGL10.EGL_ALPHA_SIZE);
logger.log(level, String.format("EGL_BLUE_SIZE = %d", value[0])); logEGLConfigAttrib(conf, display, egl, level,
"EGL_STENCIL_SIZE", EGL10.EGL_STENCIL_SIZE);
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_ALPHA_SIZE, value); logEGLConfigAttrib(conf, display, egl, level,
logger.log(level, String.format("EGL_ALPHA_SIZE = %d", value[0])); "EGL_RENDERABLE_TYPE", EGL10.EGL_RENDERABLE_TYPE);
logEGLConfigAttrib(conf, display, egl, level,
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_DEPTH_SIZE, value); "EGL_SURFACE_TYPE", EGL10.EGL_SURFACE_TYPE);
logger.log(level, String.format("EGL_DEPTH_SIZE = %d", value[0])); logEGLConfigAttrib(conf, display, egl, level,
"EGL_SAMPLE_BUFFERS", EGL10.EGL_SAMPLE_BUFFERS);
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_STENCIL_SIZE, value); logEGLConfigAttrib(conf, display, egl, level,
logger.log(level, String.format("EGL_STENCIL_SIZE = %d", value[0])); "EGL_SAMPLES", EGL10.EGL_SAMPLES);
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RENDERABLE_TYPE, value);
logger.log(level, String.format("EGL_RENDERABLE_TYPE = %d", value[0]));
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SURFACE_TYPE, value);
logger.log(level, String.format("EGL_SURFACE_TYPE = %d", value[0]));
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SAMPLE_BUFFERS, value);
logger.log(level, String.format("EGL_SAMPLE_BUFFERS = %d", value[0]));
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SAMPLES, value);
logger.log(level, String.format("EGL_SAMPLES = %d", value[0]));
} }
public int getClientOpenGLESVersion() { public int getClientOpenGLESVersion() {
@ -344,7 +343,7 @@ public class AndroidConfigChooser implements EGLConfigChooser {
return keptConfig; return keptConfig;
} }
} }
logger.log(Level.WARNING, "Failed to find a suitable display configuration for FASTEST, hoping for the best..."); logger.log(Level.WARNING, "Failed to find a suitable display configuration for FASTEST, hoping for the best...");
// failsafe. pick the 1st config with a 16 bit depth buffer. // failsafe. pick the 1st config with a 16 bit depth buffer.

Loading…
Cancel
Save