From c98a0bc5fb7ffdcb33fe9ec156a07a5c1734777f Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 10 Jun 2010 00:49:02 +0000 Subject: [PATCH] Testing creation of single buffered EGL surface --- .../processing/core/PGraphicsAndroid3D.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/android/core/src/processing/core/PGraphicsAndroid3D.java b/android/core/src/processing/core/PGraphicsAndroid3D.java index d5675ebf4..99118efee 100644 --- a/android/core/src/processing/core/PGraphicsAndroid3D.java +++ b/android/core/src/processing/core/PGraphicsAndroid3D.java @@ -38,6 +38,7 @@ import android.opengl.GLSurfaceView.Renderer; import javax.microedition.khronos.opengles.*; +import javax.microedition.khronos.egl.EGL11; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLContext; @@ -4874,6 +4875,7 @@ public class PGraphicsAndroid3D extends PGraphics { EGL10.EGL_GREEN_SIZE, 4, EGL10.EGL_BLUE_SIZE, 4, EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, + //EGL10.EGL_RENDER_BUFFER, EGL10.EGL_SINGLE_BUFFER, EGL10.EGL_NONE }; @@ -4896,7 +4898,7 @@ public class PGraphicsAndroid3D extends PGraphics { */ int[] num_config = new int[1]; egl.eglChooseConfig(display, configAttribsGL2, null, 0, num_config); - + int numConfigs = num_config[0]; if (numConfigs <= 0) { @@ -4907,7 +4909,12 @@ public class PGraphicsAndroid3D extends PGraphics { */ EGLConfig[] configs = new EGLConfig[numConfigs]; egl.eglChooseConfig(display, configAttribsGL2, configs, numConfigs, num_config); - + + for(EGLConfig config : configs) { + String configStr = "A3D - selected EGL config : " + printConfig(egl, display, config); + System.out.println(configStr); + } + /* if (DEBUG) { printConfigs(egl, display, configs); @@ -4987,11 +4994,16 @@ public class PGraphicsAndroid3D extends PGraphics { int a = findConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0); int d = findConfigAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0); int s = findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0); - + int type = findConfigAttrib(egl, display, config, EGL10.EGL_RENDERABLE_TYPE, 0); + int nat = findConfigAttrib(egl, display, config, EGL10.EGL_NATIVE_RENDERABLE, 0); + int bufSize = findConfigAttrib(egl, display, config, EGL10.EGL_BUFFER_SIZE, 0); + int bufSurf = findConfigAttrib(egl, display, config, EGL10.EGL_RENDER_BUFFER, 0); + return String.format("EGLConfig rgba=%d%d%d%d depth=%d stencil=%d", r,g,b,a,d,s) - + " type=" + findConfigAttrib(egl, display, config, EGL10.EGL_RENDERABLE_TYPE, 0) - + " native=" + findConfigAttrib(egl, display, config, EGL10.EGL_NATIVE_RENDERABLE, 0) - + " buffer=" + findConfigAttrib(egl, display, config, EGL10.EGL_BUFFER_SIZE, 0) + + " type=" + type + + " native=" + nat + + " buffer size=" + bufSize + + " buffer surface=" + bufSurf + String.format(" caveat=0x%04x" , findConfigAttrib(egl, display, config, EGL10.EGL_CONFIG_CAVEAT, 0)); }