From fe78d5095ef98215ce6c73d8912dfa19ae708bd0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Aug 2012 17:11:03 +0200 Subject: Robostness FBObject / GLReadBufferUtil: Ignore pre-existing GL errors - remove GL error checking in FBObject bind/unbind. - User GL code caused errors shall not fail impl. - FBObject bind/unbind GL error checking is almost useless due to it's simple code, would only catch user GL code errors, which should be ignored here. - MultisampleDemoES2: Only enable GL_MULTISAMPLE if available, i.e. validate passed multisample flag --- make/scripts/targetcommand-newt.sh | 1 + src/jogl/classes/com/jogamp/opengl/FBObject.java | 4 +--- src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java | 4 ++++ .../opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java | 7 +++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/make/scripts/targetcommand-newt.sh b/make/scripts/targetcommand-newt.sh index 84b149b37..8cb3c2471 100755 --- a/make/scripts/targetcommand-newt.sh +++ b/make/scripts/targetcommand-newt.sh @@ -8,6 +8,7 @@ export LD_LIBRARY_PATH=$THISDIR/PVRTrace/:$LD_LIBRARY_PATH #XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext.TraceSwitch " #XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.DebugGL -Djogl.debug.TraceGL" +#XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.DebugGL" #XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.EGL -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable" #XTRA_FLAGS="-Dnewt.debug.Screen" #XTRA_FLAGS="-Dnativewindow.debug.GraphicsConfiguration -Dnativewindow.debug.NativeWindow" diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 663b4fb9d..8a6495e6b 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -725,7 +725,7 @@ public class FBObject { glerr = gl.glGetError(); if(DEBUG && GL.GL_NO_ERROR != glerr) { - System.err.println("FBObject.init-preexisting.1 GL Error 0x"+Integer.toHexString(glerr)); + System.err.println("Info: FBObject.init: pre-existing GL error 0x"+Integer.toHexString(glerr)); } this.width = width; @@ -1741,7 +1741,6 @@ public class FBObject { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer()); } - checkNoError(null, gl.glGetError(), "FBObject post-bind"); // throws GLException if error bound = true; samplesSinkDirty = true; } @@ -1766,7 +1765,6 @@ public class FBObject { } else { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } - checkNoError(null, gl.glGetError(), "FBObject post-unbind"); // throws GLException if error bound = false; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index b0fae8a6d..34cc0eb07 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -116,6 +116,10 @@ public class GLReadBufferUtil { * @see #GLReadBufferUtil(boolean, boolean) */ public boolean readPixels(GL gl, boolean flip) { + final int glerr0 = gl.glGetError(); + if(GL.GL_NO_ERROR != glerr0) { + System.err.println("Info: GLReadBufferUtil.readPixels: pre-exisiting GL error 0x"+Integer.toHexString(glerr0)); + } final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int textureInternalFormat, textureDataFormat, textureDataType; final int[] glImplColorReadVals = new int[] { 0, 0 }; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java index 5facc1a49..c80455314 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java @@ -74,12 +74,15 @@ public class MultisampleDemoES2 implements GLEventListener { public void init(GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); + System.err.println(); + System.err.println("req. msaa: "+multisample); System.err.println("Requested: " + glad.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); - System.err.println(); + multisample = multisample & glad.getChosenGLCapabilities().getNumSamples() > 0 ; System.err.println("Chosen : " + glad.getChosenGLCapabilities()); + System.err.println("has msaa: "+multisample); System.err.println(); - + final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MultisampleDemoES2.class, "shader", "shader/bin", "mgl_default_xxx", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MultisampleDemoES2.class, "shader", -- cgit v1.2.3