From 3732d0162051ffe56af34ba345b59c15bfc6f552 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 16 Aug 2012 14:47:16 +0200 Subject: Adapt to GlueGen ARM Build Changes 422d7a5eb53fca6642ebf4e8910d8b0311bb2597 Note: Patch set not clean since build*xml files contain 'NEWT Broadcom' driver changes of upcoming commit due to pervious uncommitted work. Will be fixed w/ next commit. --- make/scripts/targetcommand-newt.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'make/scripts/targetcommand-newt.sh') diff --git a/make/scripts/targetcommand-newt.sh b/make/scripts/targetcommand-newt.sh index 47b7a0b80..8b3c0945a 100755 --- a/make/scripts/targetcommand-newt.sh +++ b/make/scripts/targetcommand-newt.sh @@ -2,9 +2,11 @@ THISDIR=`pwd` +ROOT_REL=build-linux-armv6hf + 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 -Djogl.debug.GLContext.TraceSwitch " #XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.DebugGL -Djogl.debug.TraceGL" #XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.EGL -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable" #XTRA_FLAGS="-Dnewt.debug.Screen" @@ -26,7 +28,7 @@ XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.DebugGL -Djogl.deb #TSTCLASS=com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT01 # (Tegra regressions) #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT -TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrentNEWT # Some Regressions (Panda, Omap4) @@ -49,6 +51,7 @@ TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT +TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.drawable.TestDrawable01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestFBOMRTNEWT01 @@ -81,6 +84,7 @@ TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT rsync -av --delete --delete-after --delete-excluded \ --exclude 'build-x86*/' --exclude 'build-linux-x*/' --exclude 'build-android*/' --exclude 'build-win*/' --exclude 'build-mac*/' \ --exclude 'classes/' --exclude 'src/' --exclude '.git/' --exclude '*-java-src.zip' \ + --exclude 'make/lib/external/' \ jogamp@jogamp02::PROJECTS/JOGL/gluegen jogamp@jogamp02::PROJECTS/JOGL/jogl $THISDIR/projects-cross cd $THISDIR/projects-cross/jogl/make @@ -89,10 +93,9 @@ TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT function junit_run() { java \ - -cp ../../gluegen/make/lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:../../gluegen/build-linux-armv7/gluegen-rt.jar:../build-linux-armv7/jar/jogl.all-noawt.jar:../build-linux-armv7/jar/jogl.test.jar\ + -cp ../../gluegen/make/lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:../../gluegen/$ROOT_REL/gluegen-rt.jar:../$ROOT_REL/jar/jogl-all-noawt.jar:../$ROOT_REL/jar/jogl-test.jar\ -Djava.awt.headless=true\ $XTRA_FLAGS \ - com.jogamp.newt.util.MainThread\ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner \ $TSTCLASS \ filtertrace=true \ @@ -108,10 +111,9 @@ function junit_run() { function main_run() { java \ - -cp ../../gluegen/make/lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:../../gluegen/build-linux-armv7/gluegen-rt.jar:../build-linux-armv7/jar/jogl.all-noawt.jar:../build-linux-armv7/jar/jogl.test.jar\ + -cp ../../gluegen/make/lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:../../gluegen/$ROOT_REL/gluegen-rt.jar:../$ROOT_REL/jar/jogl-all-noawt.jar:../$ROOT_REL/jar/jogl-test.jar\ -Djava.awt.headless=true\ $XTRA_FLAGS \ - com.jogamp.newt.util.MainThread\ $TSTCLASS \ $* } -- cgit v1.2.3 From da697607fce1e6d2b0c65fcc37030c88981b76ec Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Aug 2012 15:33:12 +0200 Subject: Fix EGLDrawableFactory.getEGLSurface(..): Catch WrappedSurface case w/ EGLDevice and EGLGraphicsConfiguration - Regression of 43a473b2005d7f59a7f4f5b8bc7ca9ae88b4e894 Do not create a WrappedSurface around a given WrappedSurface if the latter is intended for EGL, i.e. uses EGLDevice and EGLGraphicsConfiguration even though the surface handle is not valid [yet]. For this case we assume the WrappedSurface has a lifecycle hook as it is used for the dummy drawable. Otherwise we would have a recursive WrappedSurface, ie with EGLDrawableFactory.createOnscreenDrawableImpl( dummySurface ), where dummySurface is a WrappedSurface w/ EGL pbuffer drawable lifecycle hook. Commit 43a473b2005d7f59a7f4f5b8bc7ca9ae88b4e894 didn't take the above case into account. --- make/scripts/targetcommand-newt.sh | 4 +++- make/scripts/tests.sh | 7 +++---- src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java | 9 ++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'make/scripts/targetcommand-newt.sh') diff --git a/make/scripts/targetcommand-newt.sh b/make/scripts/targetcommand-newt.sh index 8b3c0945a..84b149b37 100755 --- a/make/scripts/targetcommand-newt.sh +++ b/make/scripts/targetcommand-newt.sh @@ -44,6 +44,7 @@ export LD_LIBRARY_PATH=$THISDIR/PVRTrace/:$LD_LIBRARY_PATH #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT +TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT @@ -51,10 +52,11 @@ export LD_LIBRARY_PATH=$THISDIR/PVRTrace/:$LD_LIBRARY_PATH #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT -TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.drawable.TestDrawable01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestFBOMRTNEWT01 +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index d0a5f64ff..824daeaeb 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -61,8 +61,7 @@ function jrun() { #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock" - #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" - D_ARGS="-Djogl.debug=all" + #D_ARGS="-Djogl.debug=all" #D_ARGS="-Dnewt.debug.Window" #D_ARGS="-Djogl.debug.GLDrawable" #D_ARGS="-Djogl.debug.EGLDrawableFactory.DontQuery -Djogl.debug.GLDrawable" @@ -216,7 +215,7 @@ function testawtswt() { #testnoawt com.jogamp.newt.opengl.GLWindow $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $* @@ -235,7 +234,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $* diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index f7377a648..e145a959c 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -471,10 +471,17 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { AbstractGraphicsConfiguration aConfig = surface.getGraphicsConfiguration(); AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice(); if( aDevice instanceof EGLGraphicsDevice && aConfig instanceof EGLGraphicsConfiguration ) { + if(surface instanceof WrappedSurface) { + // already wrapped surface - no wrapped recursion + if(DEBUG) { + System.err.println(getThreadName() + ": getEGLSurface - already wrapped surface - use as-is: "+surface); + } + return surface; + } if(EGLDrawable.isValidEGLSurface((EGLGraphicsDevice)aDevice, surface)) { // already in native EGL format if(DEBUG) { - System.err.println(getThreadName() + ": getEGLSurface - already valid EGL surface - use as-is: "+aConfig); + System.err.println(getThreadName() + ": getEGLSurface - already valid EGL surface - use as-is: "+surface); } return surface; } -- cgit v1.2.3 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(-) (limited to 'make/scripts/targetcommand-newt.sh') 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 From ec0f4a5ab604c73d40d3585c0147b451ad53dcf5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 17 Aug 2012 20:50:44 +0200 Subject: GLDrawableFactory.createGLDrawable() offscreen: Fix caps - set double-buffer := false to be consistent w/ GLDrawableFactory.createOffscreenDrawable() TestGLDrawable01NEWT: Enhance test case to run w/ EGLDrawableFactory (ES2) besides GL2 and GLX/WGL/..-Factory --- make/scripts/targetcommand-awt.sh | 3 +- make/scripts/targetcommand-newt.sh | 6 +- make/scripts/tests.sh | 4 +- .../jogamp/opengl/GLDrawableFactoryImpl.java | 9 +- .../junit/jogl/acore/TestGLDrawable01NEWT.java | 171 +++++++++++++++++++ .../junit/jogl/drawable/TestDrawable01NEWT.java | 183 --------------------- 6 files changed, 186 insertions(+), 190 deletions(-) create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDrawable01NEWT.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java (limited to 'make/scripts/targetcommand-newt.sh') diff --git a/make/scripts/targetcommand-awt.sh b/make/scripts/targetcommand-awt.sh index 7f95e33a2..d776abd16 100755 --- a/make/scripts/targetcommand-awt.sh +++ b/make/scripts/targetcommand-awt.sh @@ -16,8 +16,9 @@ XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.EGL -Dnativewindow #XTRA_FLAGS="-Djogl.debug.TraceGL" #XTRA_FLAGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL" -TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT +TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGLDrawable01AWT mkdir -p $THISDIR/projects-cross diff --git a/make/scripts/targetcommand-newt.sh b/make/scripts/targetcommand-newt.sh index 8cb3c2471..1cf7c306b 100755 --- a/make/scripts/targetcommand-newt.sh +++ b/make/scripts/targetcommand-newt.sh @@ -30,7 +30,10 @@ export LD_LIBRARY_PATH=$THISDIR/PVRTrace/:$LD_LIBRARY_PATH #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT +TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestGLDrawable01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrentNEWT +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT # Some Regressions (Panda, Omap4) # @@ -45,8 +48,6 @@ export LD_LIBRARY_PATH=$THISDIR/PVRTrace/:$LD_LIBRARY_PATH #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT -TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT -#TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT @@ -55,7 +56,6 @@ TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -#TSTCLASS=com.jogamp.opengl.test.junit.jogl.drawable.TestDrawable01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestFBOMRTNEWT01 #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 824daeaeb..6aa69fa34 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -234,7 +234,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $* @@ -411,6 +411,8 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $* #testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot $* #linux: +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDrawable01NEWT $* # osx: #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $* diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index f7808294b..2f2bf5961 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -143,6 +143,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // layered surface -> Offscreen/[FBO|PBuffer] final GLCapabilities chosenCapsMod = (GLCapabilities) chosenCaps.cloneMutable(); chosenCapsMod.setOnscreen(false); + chosenCapsMod.setDoubleBuffered(false); /* if( isFBOAvailable ) { // FIXME JAU: FBO n/a yet chosenCapsMod.setFBO(true); } else */ @@ -174,17 +175,21 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { result = createOnscreenDrawableImpl(target); } else { // offscreen + final GLCapabilitiesImmutable reqCaps = (GLCapabilitiesImmutable)config.getRequestedCapabilities(); if(DEBUG) { - System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable, FBO-chosen(-avail)/PBuffer: "+chosenCaps.isFBO()+"("+isFBOAvailable+")/"+chosenCaps.isPBuffer()+": "+target); + System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OffScreenDrawable, FBO req / chosen - avail, PBuffer: "+reqCaps.isFBO()+" / "+chosenCaps.isFBO()+" - "+isFBOAvailable+", "+chosenCaps.isPBuffer()+": "+target); } if( ! ( target instanceof MutableSurface ) ) { throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen: "+target); } - if( ((GLCapabilitiesImmutable)config.getRequestedCapabilities()).isFBO() && isFBOAvailable ) { + if( reqCaps.isFBO() && isFBOAvailable ) { // FIXME JAU: Need to revise passed MutableSurface to work w/ FBO .. final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(target); result = new GLFBODrawableImpl(this, dummyDrawable, target, target.getWidth(), target.getHeight(), 0 /* textureUnit */); } else { + final GLCapabilities chosenCapsMod = (GLCapabilities) chosenCaps.cloneMutable(); + chosenCapsMod.setDoubleBuffered(false); + config.setChosenCapabilities(chosenCapsMod); result = createOffscreenDrawableImpl(target); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDrawable01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDrawable01NEWT.java new file mode 100644 index 000000000..a6e9cfb07 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDrawable01NEWT.java @@ -0,0 +1,171 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.opengl.test.junit.jogl.acore; + +import java.io.IOException; + +import javax.media.nativewindow.CapabilitiesImmutable; +import javax.media.opengl.GL; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesImmutable; +import javax.media.opengl.GLContext; +import javax.media.opengl.GLDrawable; +import javax.media.opengl.GLDrawableFactory; +import javax.media.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.Test; + +import com.jogamp.newt.NewtFactory; +import com.jogamp.newt.Window; +import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.UITestCase; + +public class TestGLDrawable01NEWT extends UITestCase { + static final int width = 200, height = 200; + + void doTest(String profile, boolean onscreen, boolean fbo, boolean pbuffer) throws InterruptedException { + if( !GLProfile.isAvailable(profile) ) { + System.err.println("Profile "+profile+" n/a"); + return; + } + + final GLProfile glp = GLProfile.get(profile); + final GLCapabilities reqGLCaps = new GLCapabilities(glp); + + reqGLCaps.setOnscreen(onscreen); + reqGLCaps.setPBuffer(!onscreen && pbuffer); + reqGLCaps.setFBO(!onscreen && fbo); + reqGLCaps.setDoubleBuffered(onscreen); + // System.out.println("Requested: "+caps); + + // + // Create native windowing resources .. X11/Win/OSX + // + Window window = NewtFactory.createWindow(reqGLCaps); + Assert.assertNotNull(window); + window.setSize(width, height); + window.setVisible(true); + AWTRobotUtil.waitForVisible(window, true); + AWTRobotUtil.waitForRealized(window, true); + // System.out.println("Created: "+window); + + // Check caps of NativeWindow config w/o GL + final CapabilitiesImmutable chosenCaps = window.getGraphicsConfiguration().getChosenCapabilities(); + Assert.assertNotNull(chosenCaps); + Assert.assertTrue(chosenCaps.getGreenBits()>5); + Assert.assertTrue(chosenCaps.getBlueBits()>5); + Assert.assertTrue(chosenCaps.getRedBits()>5); + + // + // Create native OpenGL resources .. XGL/WGL/CGL .. + // equivalent to GLAutoDrawable methods: setVisible(true) + // + final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + + final GLDrawable drawable = factory.createGLDrawable(window); + Assert.assertNotNull(drawable); + // System.out.println("Pre: "+drawable); + // + drawable.setRealized(true); + Assert.assertTrue(drawable.isRealized()); + + // Check caps of GLDrawable after realization + final GLCapabilitiesImmutable chosenGLCaps = drawable.getChosenGLCapabilities(); + Assert.assertNotNull(chosenGLCaps); + Assert.assertTrue(chosenGLCaps.getGreenBits()>5); + Assert.assertTrue(chosenGLCaps.getBlueBits()>5); + Assert.assertTrue(chosenGLCaps.getRedBits()>5); + Assert.assertTrue(chosenGLCaps.getDepthBits()>4); + Assert.assertEquals(reqGLCaps.isOnscreen(), chosenGLCaps.isOnscreen()); + Assert.assertEquals(reqGLCaps.isOnscreen(), chosenGLCaps.getDoubleBuffered()); // offscreen shall be !dbl-buffer + // System.out.println("Post: "+drawable); + + GLContext context = drawable.createContext(null); + Assert.assertNotNull(context); + // System.out.println(context); + + int res = context.makeCurrent(); + Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); + + // draw something .. + final GL gl = context.getGL(); + gl.glClearColor(1, 1, 1, 1); + gl.glEnable(GL.GL_DEPTH_TEST); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); + gl.glViewport(0, 0, width, height); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); + + drawable.swapBuffers(); + context.release(); + + Thread.sleep(50); + + context.destroy(); + drawable.setRealized(false); + window.destroy(); + // System.out.println("Final: "+window); + } + + @Test + public void testGL2OnScreen() throws InterruptedException { + doTest(GLProfile.GL2, true, false, false); + } + + @Test + public void testES2OnScreen() throws InterruptedException { + doTest(GLProfile.GLES2, true, false, false); + } + + @Test + public void testGL2PBuffer() throws InterruptedException { + doTest(GLProfile.GL2, false, false, true); + } + + @Test + public void testES2PBuffer() throws InterruptedException { + doTest(GLProfile.GLES2, false, false, true); + } + + // @Test // TODO: FBO-Drawable via createGLDrawable and pre-exisiting NativeSurface + public void testGL2FBO() throws InterruptedException { + doTest(GLProfile.GL2, false, true, false); + } + + // @Test // TODO: FBO-Drawable via createGLDrawable and pre-exisiting NativeSurface + public void testES2FBO() throws InterruptedException { + doTest(GLProfile.GLES2, false, true, false); + } + + public static void main(String args[]) throws IOException { + org.junit.runner.JUnitCore.main(TestGLDrawable01NEWT.class.getName()); + } + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java deleted file mode 100644 index 731f7c867..000000000 --- a/src/test/com/jogamp/opengl/test/junit/jogl/drawable/TestDrawable01NEWT.java +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Copyright 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -package com.jogamp.opengl.test.junit.jogl.drawable; - -import com.jogamp.opengl.test.junit.util.UITestCase; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.AfterClass; -import org.junit.Test; - -import javax.media.opengl.*; - -import com.jogamp.newt.*; -import java.io.IOException; - -public class TestDrawable01NEWT extends UITestCase { - static GLProfile glp; - static GLDrawableFactory factory; - static int width, height; - GLCapabilities caps; - Window window; - GLDrawable drawable; - GLContext context; - - @BeforeClass - public static void initClass() { - glp = GLProfile.getDefault(); - Assert.assertNotNull(glp); - factory = GLDrawableFactory.getFactory(glp); - Assert.assertNotNull(factory); - width = 640; - height = 480; - } - - @AfterClass - public static void releaseClass() { - Assert.assertNotNull(factory); - factory=null; - } - - @Before - public void initTest() { - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - } - - void createWindow(boolean onscreen, boolean pbuffer, boolean undecorated) { - caps.setOnscreen(onscreen); - caps.setPBuffer(!onscreen && pbuffer); - caps.setDoubleBuffered(onscreen); - // System.out.println("Requested: "+caps); - - // - // Create native windowing resources .. X11/Win/OSX - // - Display display = NewtFactory.createDisplay(null); // local display - Assert.assertNotNull(display); - - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - Assert.assertNotNull(screen); - - window = NewtFactory.createWindow(screen, caps); - Assert.assertNotNull(window); - window.setUndecorated(onscreen && undecorated); - window.setSize(width, height); - window.setVisible(true); - // System.out.println("Created: "+window); - - // - // Create native OpenGL resources .. XGL/WGL/CGL .. - // equivalent to GLAutoDrawable methods: setVisible(true) - // - GLCapabilities glCaps = (GLCapabilities) window.getGraphicsConfiguration().getChosenCapabilities(); - Assert.assertNotNull(glCaps); - Assert.assertTrue(glCaps.getGreenBits()>5); - Assert.assertTrue(glCaps.getBlueBits()>5); - Assert.assertTrue(glCaps.getRedBits()>5); - Assert.assertEquals(glCaps.isOnscreen(),onscreen); - Assert.assertTrue(onscreen || !pbuffer || glCaps.isPBuffer()); // pass if onscreen, or !pbuffer req. or have pbuffer - Assert.assertEquals(glCaps.getDoubleBuffered(),onscreen); - Assert.assertTrue(glCaps.getDepthBits()>4); - - drawable = factory.createGLDrawable(window); - Assert.assertNotNull(drawable); - // System.out.println("Pre: "+drawable); - // - drawable.setRealized(true); - // Assert.assertEquals(width,drawable.getWidth()); - // Assert.assertEquals(height,drawable.getHeight()); - // Assert.assertEquals(glCaps,drawable.getChosenGLCapabilities()); - Assert.assertEquals(window,drawable.getNativeSurface()); - // System.out.println("Post: "+drawable); - - context = drawable.createContext(null); - Assert.assertNotNull(context); - // System.out.println(context); - - int res = context.makeCurrent(); - Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); - - // draw something .. - - drawable.swapBuffers(); - context.release(); - - // System.out.println("Final: "+window); - } - - void destroyWindow() { - // GLWindow.dispose(..) sequence - Assert.assertNotNull(context); - context.destroy(); - - Assert.assertNotNull(drawable); - drawable.setRealized(false); - - // GLWindow.destroy(..) sequence cont.. - Assert.assertNotNull(window); - window.destroy(); - - drawable = null; - context = null; - window = null; - } - - @Test - public void testOnScreenDecorated() throws InterruptedException { - createWindow(true, false, false); - Thread.sleep(1000); // 1000 ms - destroyWindow(); - } - - @Test - public void testOnScreenUndecorated() throws InterruptedException { - createWindow(true, false, true); - Thread.sleep(1000); // 1000 ms - destroyWindow(); - } - - public static void main(String args[]) throws IOException { - String tstname = TestDrawable01NEWT.class.getName(); - org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { - tstname, - "filtertrace=true", - "haltOnError=false", - "haltOnFailure=false", - "showoutput=true", - "outputtoformatters=true", - "logfailedtests=true", - "logtestlistenerevents=true", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); - } - -} -- cgit v1.2.3