From 86c164950b0a0d351fc8af3884187b10201b6237 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 27 Nov 2010 07:55:31 +0100 Subject: GLCanvas: Fix disableBackgroundErase/X11, make drawable creation more robust, doc Java2D/AWT properties. On X11 disableBackgroundErase() must happen before native peer creation, this patch issues it before and after super.addNotify(). Make drawable creation more robust, ie only create a drawable in case the size is > 0x0 and do this check/create at display/paint in case size it not yet determined. Add documentation about Java2D/AWT properties impact on GLCanvas. Make JUnit tests on AWT/GLProfile's more robust, while adding frame validate() ensuring 1st paint will have a size, hence will create the drawable. This is necessary for eg. AMD GPU's and GL context > 3. --- src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java | 5 +++++ src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'src/junit/com') diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java index 88551bdb4..0fef76c7d 100644 --- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java +++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java @@ -85,7 +85,12 @@ public class TestAWT01GLn extends UITestCase { glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); frame.add(glCanvas); + + // Revalidate size/layout. + // Always validate if component added/removed. + // Ensure 1st paint of GLCanvas will have a valid size, hence drawable gets created. frame.setSize(512, 512); + frame.validate(); glCanvas.addGLEventListener(new Gears()); diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java index 661f61d37..74ca0a3e7 100644 --- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java +++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java @@ -85,7 +85,13 @@ public class TestSwingAWT01GLn extends UITestCase { glCanvas[0] = new GLCanvas(caps); glCanvas[0].addGLEventListener(new Gears()); window.add(glCanvas[0]); + + // Revalidate size/layout. + // Always validate if component added/removed. + // Ensure 1st paint of GLCanvas will have a valid size, hence drawable gets created. window.setSize(512, 512); + window.validate(); + window.setVisible(true); glCanvas[0].display(); } -- cgit v1.2.3