aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/scripts/tests-x64.bat3
-rw-r--r--make/scripts/tests.sh7
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java16
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java129
5 files changed, 145 insertions, 13 deletions
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index 5057caba6..2b8edec8d 100644
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -1,8 +1,9 @@
REM scripts\java-win64-dbg.bat com.jogamp.newt.opengl.GLWindow
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.acore.TestGLProfile01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.demos.gl2.gears.newt.TestGearsNEWT -time 30000
+scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT -time 5000
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
-scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT
+REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.jogl.glsl.TestGLSLSimple01NEWT -time 2000
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestParenting01AWT
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index e6b787b40..27ed1b710 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -36,9 +36,9 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.EDT -Djogamp.debug.Lock"
#D_ARGS="-Dnewt.debug.EDT"
#D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all"
- #D_ARGS="-Djogl.debug=all"
+ D_ARGS="-Djogl.debug=all"
#D_ARGS="-Djogl.debug.GraphicsConfiguration"
- #X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false"
+ #X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=true"
java $awtarg $X_ARGS $D_ARGS $* 2>&1 | tee -a java-run.log
}
@@ -57,7 +57,7 @@ function testawt() {
#testawt com.jogamp.newt.opengl.GLWindow $*
#testnoawt com.jogamp.test.junit.jogl.acore.TestGLProfile01NEWT $*
#testawt com.jogamp.test.junit.jogl.acore.TestGLProfile01NEWT $*
-testnoawt com.jogamp.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT $*
+#testnoawt com.jogamp.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT $*
#testnoawt com.jogamp.test.junit.jogl.glsl.TestGLSLSimple01NEWT $*
#testnoawt com.jogamp.test.junit.newt.TestRemoteWindow01NEWT -time 1000000
#testnoawt com.jogamp.test.junit.newt.TestRemoteGLWindows01NEWT -time 1000000
@@ -82,6 +82,7 @@ testnoawt com.jogamp.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEW
#testawt com.jogamp.test.junit.jogl.awt.TestAWT02WindowClosing
#testawt com.jogamp.test.junit.jogl.awt.TestSwingAWT01GLn
#testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsAWT
+testawt com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT
#testawt com.jogamp.test.junit.jogl.texture.TestTexture01AWT
#
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 0f724d558..c69603e41 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -219,10 +219,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
}
if (backend != null) {
- boolean animatorWasAnimating = false;
+ boolean animatorPaused = false;
GLAnimatorControl animator = getAnimator();
if(null!=animator) {
- animatorWasAnimating = animator.isAnimating();
+ if(regenerate) {
+ animatorPaused = animator.pause();
+ } else {
+ animator.remove(this);
+ }
}
disposeRegenerate=regenerate;
@@ -254,8 +258,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
isInitialized = false;
}
- if(regenerate && animatorWasAnimating && animator.isPaused()) {
- animator.resume();
+ if(animatorPaused) {
+ animator.resume();
}
}
@@ -1581,9 +1585,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
System.err.println("-- Created Context: "+joglContext);
}
}
- if (DEBUG) {
+ /*if (DEBUG) {
joglContext.setGL(new DebugGL2(joglContext.getGL().getGL2()));
- }
+ }*/
if (Java2D.isFBOEnabled() &&
Java2D.getOGLSurfaceType(g) == Java2D.FBOBJECT &&
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
index 9639c384b..3e7e5988b 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
@@ -38,14 +38,11 @@ import com.jogamp.newt.event.TraceWindowAdapter;
import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.util.QuitAdapter;
-import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import java.awt.Frame;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
-import org.junit.After;
import org.junit.Test;
public class TestGearsAWT extends UITestCase {
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java
new file mode 100644
index 000000000..a3358e0b8
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWT.java
@@ -0,0 +1,129 @@
+/**
+ * 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.test.junit.jogl.demos.gl2.gears;
+
+import javax.media.opengl.*;
+import com.jogamp.opengl.util.FPSAnimator;
+import javax.media.opengl.awt.GLJPanel;
+
+import com.jogamp.test.junit.util.UITestCase;
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+public class TestGearsGLJPanelAWT extends UITestCase {
+ static GLProfile glp;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(false);
+ glp = GLProfile.getDefault();
+ Assert.assertNotNull(glp);
+ width = 512;
+ height = 512;
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void runTestGL(GLCapabilities caps)
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ JFrame frame = new JFrame("Swing GLJPanel");
+ Assert.assertNotNull(frame);
+
+ GLJPanel glJPanel = new GLJPanel(caps);
+ Assert.assertNotNull(glJPanel);
+ glJPanel.addGLEventListener(new Gears());
+
+ FPSAnimator animator = new FPSAnimator(glJPanel, 60);
+
+ final JFrame _frame = frame;
+ final GLJPanel _glJPanel = glJPanel;
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ _frame.getContentPane().add(_glJPanel, BorderLayout.CENTER);
+ _frame.setSize(512, 512);
+ _frame.setVisible(true);
+ } } ) ;
+
+ animator.start();
+ Assert.assertEquals(true, animator.isAnimating());
+
+ while(animator.isAnimating() && animator.getDuration()<duration) {
+ Thread.sleep(100);
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glJPanel);
+ Assert.assertNotNull(animator);
+
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ _frame.setVisible(false);
+ _frame.getContentPane().remove(_glJPanel);
+ _frame.remove(_glJPanel);
+ _glJPanel.destroy();
+ _frame.dispose();
+ } } );
+ }
+
+ @Test
+ public void test01()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ runTestGL(caps);
+ }
+
+ static long duration = 500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestGearsGLJPanelAWT.class.getName());
+ }
+}