aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-01-08 06:52:03 +0100
committerSven Gothel <[email protected]>2012-01-08 06:52:03 +0100
commit9e61d4529143ff3f6de15ce55f8e8747f67a86c9 (patch)
treee1bb4cee6e0f3f7859de658d12d49f9597590831
parent6451e3c0c79fca92a39e32c2600c69f16dfc7f4d (diff)
TestAWTCardLayoutAnimatorStartStopBug532: Refine, add 'continue' mode, ..
Previous commit 098398c2a9145447da5314eed9792b3738c2d515 cleaned up and fixed context/drawable lock/unlock for makeCurrent()/release()/destroy() and consistency is looks much better now in this regard. However, on Intel HD 3000 / Windows7, our AnimatorControl start/stop still let the 2nd switch to GLCanvas within the CardPanel not showing rendering results. One interesting artefact though: 1st switch 2 GLCanvas (rendering visible): *** hdc 0x2f010ec5, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] *** hdc 0x160110c4, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] *** hdc 0x2f010ec5, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] *** hdc 0x160110c4, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] -> alternating HDC's 2nd switch 2 GLCanvas (rendering _not_ visible): *** hdc 0x160110c4, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] *** hdc 0x160110c4, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] *** hdc 0x160110c4, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] *** hdc 0x160110c4, hdw(hdc) 0x1003a0, hdw 0x1003a0 - AWT-EventQueue-0, com.jogamp.opengl.util.Animator[started true, animating true, paused false, drawable 1] -> fixed HDC Maybe this is a hint for what is going wrong in JAWTWindow locking, which aquires the frame's HDC. Verifying the recursive lock shows proper lock/unlock actions though.
-rwxr-xr-xmake/scripts/java-win64-dbg.bat4
-rwxr-xr-xmake/scripts/tests-x64.bat3
-rwxr-xr-xmake/scripts/tests.sh8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java111
4 files changed, 91 insertions, 35 deletions
diff --git a/make/scripts/java-win64-dbg.bat b/make/scripts/java-win64-dbg.bat
index d84e2e635..802c011cf 100755
--- a/make/scripts/java-win64-dbg.bat
+++ b/make/scripts/java-win64-dbg.bat
@@ -20,7 +20,9 @@ REM set D_ARGS="-Djogamp.debug.JNILibLoader=true" "-Djogamp.debug.NativeLibrary=
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.Lock" "-Djogamp.debug.Lock.TraceLock"
REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Djogl.debug=all"
-set D_ARGS="-Dnewt.debug.Window"
+REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceLock" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
+set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceLock"
+REM set D_ARGS="-Dnewt.debug.Window"
REM set D_ARGS="-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.DebugGL" "-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.GLSLCode"
REM set D_ARGS="-Djogl.debug.GraphicsConfiguration" "-Djogl.debug.CapabilitiesChooser"
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index 19128bec0..69c852338 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -15,7 +15,8 @@ REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 4000 -x 10 -y 10 -width 100 -height 100 -screen 0
-scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %*
+REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 40000 -width 100 -height 100 -screen 0 %*
+scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT -time 5000
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.awt.TestAWT03GLCanvasRecreate01
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index c8654f3e8..9667fdcd2 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -56,11 +56,11 @@ function jrun() {
#D_ARGS="-Dnewt.debug.MainThread"
#D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug=all"
- #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator"
+ D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLProfile"
- # D_ARGS="-Dnewt.debug.EDT -Dnativewindow.debug.ToolkitLock.TraceLock -Dnativewindow.debug.NativeWindow"
+ #D_ARGS="-Dnewt.debug.EDT -Dnativewindow.debug.ToolkitLock.TraceLock -Dnativewindow.debug.NativeWindow"
#D_ARGS="-Dnativewindow.debug.NativeWindow"
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT"
#D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Window -Djogl.debug.GLContext"
@@ -234,7 +234,7 @@ function testswt() {
#testawt com.jogamp.opengl.test.junit.jogl.texture.TestGrayTextureFromFileAWTBug417
#testawt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAWT01GLn $*
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug463ScaleImageMemoryAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $*
#
# swt (testswt)
@@ -245,7 +245,7 @@ testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStop
#
# newt.awt (testawt)
#
-#testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
+testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper
#testawt com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug
#testawt com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
index 83578acdd..d230f153e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
@@ -9,8 +9,11 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.reflect.InvocationTargetException;
+import javax.media.nativewindow.NativeWindow;
import javax.media.opengl.GLAnimatorControl;
+import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JComboBox;
@@ -18,8 +21,11 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import jogamp.nativewindow.windows.GDI;
+
import org.junit.Test;
+import com.jogamp.common.os.Platform;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -30,6 +36,10 @@ public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase {
static final String LABEL = "Label";
static final String CANVAS = "GLCanvas";
+ public enum AnimatorControlBehavior {
+ StartStop, PauseResume, Continue;
+ }
+
static long durationPerTest = 200*4; // ms
static boolean manual = false;
static volatile boolean shouldStop = false;
@@ -38,37 +48,70 @@ public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase {
@Test
public void testFPSAnimatorStartStop() throws InterruptedException, InvocationTargetException {
- testImpl(true, true);
+ testImpl(AnimatorControlBehavior.StartStop, true);
}
@Test
public void testFPSAnimatorResumePause() throws InterruptedException, InvocationTargetException {
- testImpl(false, true);
+ testImpl(AnimatorControlBehavior.PauseResume, true);
+ }
+
+ @Test
+ public void testFPSAnimatorContinue() throws InterruptedException, InvocationTargetException {
+ testImpl(AnimatorControlBehavior.Continue, true);
}
@Test
public void testAnimatorStartStop() throws InterruptedException, InvocationTargetException {
- testImpl(true, false);
+ testImpl(AnimatorControlBehavior.StartStop, false);
}
@Test
public void testAnimatorResumePause() throws InterruptedException, InvocationTargetException {
- testImpl(false, false);
+ testImpl(AnimatorControlBehavior.PauseResume, false);
+ }
+
+ @Test
+ public void testAnimatorContinue() throws InterruptedException, InvocationTargetException {
+ testImpl(AnimatorControlBehavior.Continue, false);
}
- void testImpl(final boolean useAnimStartStop, boolean useFPSAnimator) throws InterruptedException, InvocationTargetException {
+ void testImpl(final AnimatorControlBehavior animCtrl, boolean useFPSAnimator) throws InterruptedException, InvocationTargetException {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
final GLCanvas canvas = new GLCanvas(caps);
canvas.setPreferredSize(new Dimension(640, 480));
- canvas.addGLEventListener(new GearsES2(1));
final GLAnimatorControl animatorCtrl = useFPSAnimator ? new FPSAnimator(canvas, 60) : new Animator(canvas);
animatorCtrl.setUpdateFPSFrames(60, System.err);
- if(!useAnimStartStop) {
- animatorCtrl.start();
- animatorCtrl.pause();
+ switch (animCtrl) {
+ case PauseResume:
+ animatorCtrl.start();
+ animatorCtrl.pause();
+ break;
+ case Continue:
+ animatorCtrl.start();
+ break;
+ }
+
+ canvas.addGLEventListener(new GearsES2(1));
+ if(Platform.OS_TYPE == Platform.OSType.WINDOWS) {
+ canvas.addGLEventListener(new GLEventListener() {
+ public void init(GLAutoDrawable drawable) { }
+ public void dispose(GLAutoDrawable drawable) { }
+ public void display(GLAutoDrawable drawable) {
+ final NativeWindow win = (NativeWindow) drawable.getNativeSurface();
+ long hdc = win.getSurfaceHandle();
+ long hdw = win.getWindowHandle();
+ long hdw_hdc = GDI.WindowFromDC(hdc);
+ // System.err.println("*** hdc 0x"+Long.toHexString(hdc)+", hdw(hdc) 0x"+Long.toHexString(hdw_hdc)+", hdw 0x"+Long.toHexString(hdw) + " - " + Thread.currentThread().getName() + ", " + animatorCtrl);
+ // System.err.println(drawable.getNativeSurface().toString());
+ }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width,
+ int height) { }
+ });
}
+
final JFrame frame = new JFrame();
frame.setTitle(getSimpleTestName());
frame.addWindowListener(new WindowAdapter() {
@@ -84,30 +127,40 @@ public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase {
final JComboBox comboBox = new JComboBox(new String[] { LABEL, CANVAS });
comboBox.setEditable(false);
comboBox.addItemListener(new ItemListener() {
- public void itemStateChanged(ItemEvent evt) {
- final String os = selected;
- CardLayout cl = (CardLayout)(cards.getLayout());
- String s = (String)evt.getItem();
- if(s.equals(CANVAS)) {
- if(useAnimStartStop) {
- animatorCtrl.start();
- } else {
- animatorCtrl.resume();
- }
- cl.show(cards, CANVAS);
- selected = CANVAS;
- } else if(s.equals(LABEL)) {
- if(useAnimStartStop) {
- animatorCtrl.stop();
+ public void itemStateChanged(final ItemEvent evt) {
+ final CardLayout cl = (CardLayout)(cards.getLayout());
+ final String newSelection = (String)evt.getItem();
+ if(!newSelection.equals(selected)) {
+ final String oldSelected = selected;
+ if(newSelection.equals(CANVAS)) {
+ switch (animCtrl) {
+ case StartStop:
+ animatorCtrl.start();
+ break;
+ case PauseResume:
+ animatorCtrl.resume();
+ break;
+ }
+ cl.show(cards, CANVAS);
+ selected = CANVAS;
+ } else if(newSelection.equals(LABEL)) {
+ switch (animCtrl) {
+ case StartStop:
+ animatorCtrl.stop();
+ break;
+ case PauseResume:
+ animatorCtrl.pause();
+ break;
+ }
+ cl.show(cards, LABEL);
+ selected = LABEL;
} else {
- animatorCtrl.pause();
+ throw new RuntimeException("oops .. unexpected item: "+evt);
}
- cl.show(cards, LABEL);
- selected = LABEL;
+ System.err.println("Item Change: "+oldSelected+" -> "+selected+", "+animatorCtrl);
} else {
- throw new RuntimeException("oops .. unexpected item: "+evt);
+ System.err.println("Item Stays: "+selected+", "+animatorCtrl);
}
- System.err.println("Item Change "+os+" -> "+selected+", "+animatorCtrl);
}
});
comboBoxPanel.add(comboBox);