diff options
author | Sven Gothel <[email protected]> | 2012-11-21 18:38:46 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-11-21 18:38:46 +0100 |
commit | 7e5371ca8eafce28c242fa7fbd8aec045fc81b71 (patch) | |
tree | a9fcaec530fec07319f8b58583d1e89ef0c17a9e /src | |
parent | 1f33b196d339006d132fc6adafa345913bc08f53 (diff) |
OSX CALayer Stencil/.. Fix: In case of FBO CALayer usage, use default caps/pixelformat w/ chosen GLProfile only
Using a pixelformat w/ chosen stencil for CALayer does corrupt rendering for an unknown reason,
probably due to incompatible pixelformat w/ CALayer composition.
This patch simply discards any special chosen caps, while only recognizing the desired GLProfile
for the FBO CALayer pixelformat.
Diffstat (limited to 'src')
9 files changed, 309 insertions, 66 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index 2bb22f7b0..5c5db6d31 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -147,6 +147,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(target, true); if(null != ols) { final GLCapabilitiesImmutable chosenCapsMod = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(chosenCaps, this, adevice); + // layered surface -> Offscreen/[FBO|PBuffer] if( !chosenCapsMod.isFBO() && !chosenCapsMod.isPBuffer() ) { throw new GLException("Neither FBO nor Pbuffer is available for "+chosenCapsMod+", "+target); @@ -155,7 +156,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { ols.setChosenCapabilities(chosenCapsMod); if(DEBUG) { System.err.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable -> Offscreen-Layer"); - System.err.println("chosenCaps: "+chosenCaps); + System.err.println("chosenCaps: "+chosenCaps); System.err.println("chosenCapsMod: "+chosenCapsMod); System.err.println("OffscreenLayerSurface: **** "+ols); System.err.println("Target: **** "+target); @@ -165,7 +166,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target); } if( chosenCapsMod.isFBO() ) { - // target surface is already a native one result = createFBODrawableImpl(target, chosenCapsMod, 0); } else { result = createOffscreenDrawableImpl(target); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 1c59b8d97..cde9841b8 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -568,24 +568,38 @@ public abstract class MacOSXCGLContext extends GLContextImpl if( !incompleteView && surface instanceof ProxySurface ) { incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE ); } - long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(chosenCaps, ctp, major, minor); + long pixelFormat; + { + final GLCapabilitiesImmutable targetCaps; + if( isFBO ) { + // Use minimum GLCapabilities for the target surface w/ same profile + targetCaps = new GLCapabilities( chosenCaps.getGLProfile() ); + } else { + targetCaps = chosenCaps; + } + pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(targetCaps, ctp, major, minor); + } if (pixelFormat == 0) { if(DEBUG) { System.err.println("Unable to allocate pixel format with requested GLCapabilities: "+chosenCaps); } return 0; } - GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat); - if( !fixedCaps.isPBuffer() && isPBuffer ) { - throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable); - } - { // determine on-/offscreen caps, since pformat is ambiguous - fixedCaps.setFBO( isFBO ); // exclusive - fixedCaps.setPBuffer( isPBuffer ); // exclusive - fixedCaps.setBitmap( false ); // n/a in our OSX impl. - fixedCaps.setOnscreen( !isFBO && !isPBuffer ); + final GLCapabilitiesImmutable fixedCaps; + if( isFBO ) { + // pixelformat of target doesn't affect caps w/ FBO + fixedCaps = chosenCaps; + } else { + final GLCapabilities _fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat); + if( !_fixedCaps.isPBuffer() && isPBuffer ) { + throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable); + } + // determine on-/offscreen caps, since pformat is ambiguous + _fixedCaps.setPBuffer( isPBuffer ); // exclusive + _fixedCaps.setBitmap( false ); // n/a in our OSX impl. + _fixedCaps.setOnscreen( !isFBO && !isPBuffer ); + fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(_fixedCaps, chosenCaps.isBackgroundOpaque()); } - fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque()); int sRefreshRate = OSXUtil.GetScreenRefreshRate(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getIndex()); screenVSyncTimeout = 1000000f / sRefreshRate; if(DEBUG) { @@ -604,10 +618,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl // Thread.dumpStack(); } config.setChosenCapabilities(fixedCaps); - /** - if(null != backingLayerHost) { - backingLayerHost.setChosenCapabilities(fixedCaps); - } */ try { final IntBuffer viewNotReady = Buffers.newDirectIntBuffer(1); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 449121be1..9e270d403 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -193,8 +193,8 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } } if(null == errMsg) { - // fix caps reflecting offscreen! (no GL available here ..) - Capabilities caps = (Capabilities) getGraphicsConfiguration().getChosenCapabilities().cloneMutable(); + // Fix caps reflecting offscreen! (no GL available here ..) + final Capabilities caps = (Capabilities) getGraphicsConfiguration().getChosenCapabilities().cloneMutable(); caps.setOnscreen(false); setChosenCapabilities(caps); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java index d9e9b2bf3..c5b4227c2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java @@ -235,20 +235,20 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testGL2OnScreenDblBuf() throws InterruptedException { + public void testGL2OnScreenSglBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; + reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } - + @Test - public void testGL2OnScreenSglBuf() throws InterruptedException { + public void testGL2OnScreenDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; - reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } - + @Test public void testGL2OffScreenAutoDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); @@ -258,21 +258,21 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testGL2OffScreenFBODblBuf() throws InterruptedException { + public void testGL2OffScreenFBOSglBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); + reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testGL2OffScreenFBOSglBuf() throws InterruptedException { + public void testGL2OffScreenFBODblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); - reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } @@ -306,17 +306,17 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testES2OnScreenDblBuf() throws InterruptedException { + public void testES2OnScreenSglBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; + reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testES2OnScreenSglBuf() throws InterruptedException { + public void testES2OnScreenDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; - reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } @@ -329,21 +329,21 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testES2OffScreenFBODblBuf() throws InterruptedException { + public void testES2OffScreenFBOSglBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); + reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testES2OffScreenFBOSglBuf() throws InterruptedException { + public void testES2OffScreenFBODblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); - reqGLCaps.setDoubleBuffered(false); doTest(reqGLCaps, new GearsES2(1)); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java index 51f9cc411..f8092d064 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryOffscrnCapsNEWT.java @@ -192,7 +192,7 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase { } @Test - public void testGL2OffScreenFBOStencil() throws InterruptedException { + public void testGL2OffScreenFBODblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); @@ -202,13 +202,25 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase { } @Test - public void testGL2OffScreenFBOStencilMSAA() throws InterruptedException { + public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); reqGLCaps.setStencilBits(1); reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @@ -250,6 +262,16 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase { } @Test + public void testES2OffScreenFBOSglBuf() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setDoubleBuffered(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test public void testES2OffScreenFBODblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; @@ -259,12 +281,35 @@ public class TestGLAutoDrawableFactoryOffscrnCapsNEWT extends UITestCase { } @Test - public void testES2OffScreenFBOSglBuf() throws InterruptedException { + public void testES2OffScreenFBODblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); - reqGLCaps.setDoubleBuffered(false); + reqGLCaps.setStencilBits(1); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OffScreenFBODblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OffScreenFBODblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java index a2ffa9069..0673e2f45 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java @@ -247,76 +247,89 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { } @Test - public void testGL2OnScreen() throws InterruptedException { + public void testGL2OnScreenDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testGL2OffScreenAuto() throws InterruptedException { + public void testGL2OnScreenDblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; - reqGLCaps.setOnscreen(false); + reqGLCaps.setStencilBits(1); doTest(reqGLCaps, new GearsES2(1)); } - + @Test - public void testGL2OffScreenFBOMSAA() throws InterruptedException { + public void testGL2OnScreenDblBufMSAA() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; - reqGLCaps.setOnscreen(false); - reqGLCaps.setFBO(true); reqGLCaps.setSampleBuffers(true); reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testGL2OffScreenPbuffer() throws InterruptedException { + public void testGL2OnScreenDblBufStencilMSAA() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; - reqGLCaps.setOnscreen(false); - reqGLCaps.setPBuffer(true); + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testES2OnScreen() throws InterruptedException { - final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + public void testGL2OffScreenAutoDblBuf() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenFBODblBufStencil() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setStencilBits(1); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testES2OffScreenAuto() throws InterruptedException { - final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testES2OffScreenFBOMSAA() throws InterruptedException { - final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); + reqGLCaps.setStencilBits(1); reqGLCaps.setSampleBuffers(true); reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @Test - public void testES2OffScreenPbuffer() throws InterruptedException { - final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + public void testGL2OffScreenPbuffer() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setPBuffer(true); doTest(reqGLCaps, new GearsES2(1)); } - public static void main(String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java index da5456777..0a6056606 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java @@ -189,6 +189,14 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test + public void testGL2OnScreenSglBuf() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setDoubleBuffered(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test public void testGL2OnScreenDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; @@ -196,10 +204,29 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testGL2OnScreenSglBuf() throws InterruptedException { + public void testGL2OnScreenDblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; - reqGLCaps.setDoubleBuffered(false); + reqGLCaps.setStencilBits(1); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OnScreenDblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OnScreenDblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @@ -212,6 +239,16 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test + public void testGL2OffScreenFBOSglBuf() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setDoubleBuffered(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test public void testGL2OffScreenFBODblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; @@ -221,12 +258,35 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testGL2OffScreenFBOSglBuf() throws InterruptedException { + public void testGL2OffScreenFBODblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); - reqGLCaps.setDoubleBuffered(false); + reqGLCaps.setStencilBits(1); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @@ -260,6 +320,14 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test + public void testES2OnScreenSglBuf() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setDoubleBuffered(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test public void testES2OnScreenDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; @@ -267,10 +335,29 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testES2OnScreenSglBuf() throws InterruptedException { + public void testES2OnScreenDblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; - reqGLCaps.setDoubleBuffered(false); + reqGLCaps.setStencilBits(1); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OnScreenDblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OnScreenDblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } @@ -283,6 +370,16 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test + public void testES2OffScreenFBOSglBuf() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setDoubleBuffered(false); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test public void testES2OffScreenFBODblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; @@ -292,12 +389,35 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { } @Test - public void testES2OffScreenFBOSglBuf() throws InterruptedException { + public void testES2OffScreenFBODblBufStencil() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; reqGLCaps.setOnscreen(false); reqGLCaps.setFBO(true); - reqGLCaps.setDoubleBuffered(false); + reqGLCaps.setStencilBits(1); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OffScreenFBODblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(reqGLCaps, new GearsES2(1)); + } + + @Test + public void testES2OffScreenFBODblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); + if(null == reqGLCaps) return; + reqGLCaps.setOnscreen(false); + reqGLCaps.setFBO(true); + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); doTest(reqGLCaps, new GearsES2(1)); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java index 37483f7e7..f4999c0fa 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java @@ -266,18 +266,67 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase } @Test - public void testGL2OffScreenLayerAuto() throws InterruptedException { + public void testGL2OnScreenDblBufStencil() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setStencilBits(1); + doTest(false, reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OnScreenDblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(false, reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OnScreenDblBufStencilMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setStencilBits(1); + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(false, reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenLayerAutoDblBuf() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; doTest(true, reqGLCaps, new GearsES2(1)); } @Test - public void testGL2OffScreenFBOMSAA() throws InterruptedException { + public void testGL2OffScreenFBODblBufStencil() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setFBO(true); + reqGLCaps.setOnscreen(true); // get native NEWT Window, not OffscreenWindow + reqGLCaps.setStencilBits(1); + doTest(true, reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException { + final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); + if(null == reqGLCaps) return; + reqGLCaps.setFBO(true); + reqGLCaps.setOnscreen(true); // get native NEWT Window, not OffscreenWindow + reqGLCaps.setSampleBuffers(true); + reqGLCaps.setNumSamples(4); + doTest(true, reqGLCaps, new GearsES2(1)); + } + + @Test + public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2); if(null == reqGLCaps) return; reqGLCaps.setFBO(true); reqGLCaps.setOnscreen(true); // get native NEWT Window, not OffscreenWindow + reqGLCaps.setStencilBits(1); reqGLCaps.setSampleBuffers(true); reqGLCaps.setNumSamples(4); doTest(true, reqGLCaps, new GearsES2(1)); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index 07899b7d6..0a8063297 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -65,6 +65,7 @@ public class TestGearsES2AWT extends UITestCase { static boolean shallUseOffscreenLayer = false; static boolean shallUseOffscreenPBufferLayer = false; static boolean useMSAA = false; + static boolean useStencil = false; static boolean addComp = true; static boolean shutdownRemoveGLCanvas = true; static boolean shutdownDisposeFrame = true; @@ -159,6 +160,9 @@ public class TestGearsES2AWT extends UITestCase { caps.setNumSamples(4); caps.setSampleBuffers(true); } + if(useStencil) { + caps.setStencilBits(1); + } if(shallUseOffscreenLayer) { caps.setOnscreen(false); } @@ -192,6 +196,8 @@ public class TestGearsES2AWT extends UITestCase { shallUseOffscreenPBufferLayer = true; } else if(args[i].equals("-msaa")) { useMSAA = true; + } else if(args[i].equals("-stencil")) { + useStencil = true; } else if(args[i].equals("-wait")) { waitForKey = true; } else if(args[i].equals("-justGears")) { |