From 8a16d590fe2c739badbabe4906cbe9d60b20e2b9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 12 Nov 2011 16:15:54 +0100 Subject: OS X Layered View Part8: Generalize OffscreenLayerSurface ; Use local JAWT instance ; Applet's on OS X are working Generalize OffscreenLayerSurface - Using new OffscreenLayerSurface allows using this functionality in a clean manner, ie. no 'dirty' usage of MacOSXJAWTWindow in a JOGL GL class. - 'Promoting' OffscreenLayerSurface functionality to JAWTWindow and it's handling to GLDrawableFactoryImpl::createGLDrawable(). - Move MacOSXCGLDrawableFactory's "MacOSXJAWTWindow getLayeredSurfaceHost(NativeSurface surface)" to NativeWindowFactory "OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled)" Use local JAWT instance - Only w/ a local JAWT instance per JAWTWindow it is possible to switch between offscreen-layer and onscreen. We also have to determing offscreen-layer lazy at surface lock, since only at that time we have knowledge whether it's an Applet or not. +++ ContextUpdater: Use local pthread mutex, add DEBUG output JAWTWindow/NewtCanvasAWT: Adding methods to request offscreen-layer-surface (if supported), besides 'if applet' this may trigger the new functionality. +++ Applet's on OS X are working: - OS X 10.6.4 - Safari: - Hangs for a while at start .. whole screen freezes .. approx. 10s - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input isn't assigned sometimes. - Otherwise .. works well, incl. offscreen/onscreen parenting - Firefox 8.0: - Hangs for a while at start .. whole screen freezes .. approx. 10s - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input is never assigned. - Otherwise .. works well, incl. offscreen/onscreen parenting - OS X 10.7 - Safari: - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input isn't assigned sometimes. - Otherwise .. works well, incl. offscreen/onscreen parenting - Firefox 8.0: - Sometimes crashes when Applet stops - after all our resources are released! - Keyboard input is never assigned. - Otherwise .. works well, incl. offscreen/onscreen parenting --- .../TestParentingOffscreenLayer01AWT.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/test/com') diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01AWT.java index 378d43049..d6bf192c0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01AWT.java @@ -63,8 +63,6 @@ public class TestParentingOffscreenLayer01AWT extends UITestCase { @BeforeClass public static void initClass() { - // force offscreen layer JAWT, if available - JAWTUtil.setCachedJAWTVersionFlags(true); // useOffScreenLayerIfAvailable := true frameSize = new Dimension(500,300); preferredGLSize = new Dimension(400,200); minGLSize = new Dimension(200,100); @@ -105,7 +103,7 @@ public class TestParentingOffscreenLayer01AWT extends UITestCase { } } - @Test + // @Test public void testOffscreenLayerPath0_GLCanvas() throws InterruptedException, InvocationTargetException { final Frame frame1 = new Frame("AWT Parent Frame"); @@ -127,21 +125,22 @@ public class TestParentingOffscreenLayer01AWT extends UITestCase { end(animator1, frame1, null); } + @Test + public void testOnscreenLayer() throws InterruptedException, InvocationTargetException { + testOffscreenLayerPath1_Impl(false, false); + } + @Test public void testOffscreenLayerPath1_NewtOffscreen() throws InterruptedException, InvocationTargetException { - testOffscreenLayerPath1_Impl(true); + testOffscreenLayerPath1_Impl(true, true); } @Test public void testOffscreenLayerPath1_NewtOnscreen() throws InterruptedException, InvocationTargetException { - testOffscreenLayerPath1_Impl(false); + testOffscreenLayerPath1_Impl(true, false); } - private void testOffscreenLayerPath1_Impl(boolean newtOffscreenClass) throws InterruptedException, InvocationTargetException { - if( newtOffscreenClass && !JAWTUtil.isCachedJAWTUsingOffscreenLayer() ) { - System.err.println("JAWT OffscreenLayer n/a on this platform."); - return; - } + private void testOffscreenLayerPath1_Impl(boolean offscreenLayer, boolean newtOffscreenClass) throws InterruptedException, InvocationTargetException { final Frame frame1 = new Frame("AWT Parent Frame"); GLCapabilities glCaps = new GLCapabilities(null); @@ -152,7 +151,8 @@ public class TestParentingOffscreenLayer01AWT extends UITestCase { GLWindow glWindow1 = GLWindow.create(glCaps); - final NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); + final NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); + newtCanvasAWT1.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported newtCanvasAWT1.setPreferredSize(preferredGLSize); newtCanvasAWT1.setMinimumSize(minGLSize); -- cgit v1.2.3