summaryrefslogtreecommitdiffstats
path: root/src/junit/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java1
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java65
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java1
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java)16
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java)3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java (renamed from src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java)2
-rw-r--r--src/junit/com/jogamp/test/junit/util/DumpVersion.java (renamed from src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java)2
-rw-r--r--src/junit/com/jogamp/test/junit/util/QuitAdapter.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java)4
8 files changed, 30 insertions, 64 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
index e6988582c..0c64cfdf2 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
@@ -29,6 +29,7 @@
package com.jogamp.test.junit.jogl.acore;
import com.jogamp.test.junit.util.UITestCase;
+import com.jogamp.test.junit.util.DumpVersion;
import org.junit.Assert;
import org.junit.Before;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
index d0f915e03..d9194c216 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
@@ -2,18 +2,14 @@
package com.jogamp.test.junit.jogl.demos.gl2.gears;
import javax.media.opengl.*;
-import javax.media.opengl.awt.*;
-import com.jogamp.opengl.util.Animator;
+
import com.jogamp.newt.event.*;
import com.jogamp.newt.event.awt.*;
-
-import java.awt.Component;
-import java.awt.Frame;
import com.jogamp.newt.Window;
/**
* Gears.java <BR>
- * author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel) <P>
+ * author: Brian Paul (converted to Java by Ron Cemer and Sven Gothel) <P>
*
* This version is equal to Brian Paul's version 1.2 1999/10/21
*/
@@ -24,8 +20,8 @@ public class Gears implements GLEventListener {
private float angle = 0.0f;
private int swapInterval;
- private int prevMouseX, prevMouseY;
private boolean mouseRButtonDown = false;
+ private int prevMouseX, prevMouseY;
public Gears(int swapInterval) {
this.swapInterval = swapInterval;
@@ -35,42 +31,6 @@ public class Gears implements GLEventListener {
this.swapInterval = 1;
}
- public static void main(String[] args) {
- // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
- // <application-desc main-class="demos.j2d.TextCube"/>
- // <argument>NotFirstUIActionOnProcess</argument>
- // </application-desc>
- boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ;
- GLProfile.initSingleton(firstUIActionOnProcess);
-
- Frame frame = new Frame("Gear Demo");
- GLCanvas canvas = new GLCanvas();
- // GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
- // GLCanvas canvas = new GLCanvas(caps);
-
- final Gears gears = new Gears();
- canvas.addGLEventListener(gears);
-
- frame.add(canvas);
- frame.setSize(300, 300);
- final Animator animator = new Animator(canvas);
- frame.addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosing(java.awt.event.WindowEvent e) {
- // Run this on another thread than the AWT event queue to
- // make sure the call to Animator.stop() completes before
- // exiting
- new Thread(new Runnable() {
- public void run() {
- animator.stop();
- System.exit(0);
- }
- }).start();
- }
- });
- frame.setVisible(true);
- animator.start();
- }
-
public void init(GLAutoDrawable drawable) {
System.err.println("Gears: Init");
// Use debug pipeline
@@ -113,12 +73,12 @@ public class Gears implements GLEventListener {
// MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
MouseListener gearsMouse = new GearsMouseAdapter();
- if (drawable instanceof Component) {
- Component comp = (Component) drawable;
- new AWTMouseAdapter(gearsMouse).addTo(comp);
- } else if (drawable instanceof Window) {
+ if (drawable instanceof Window) {
Window window = (Window) drawable;
window.addMouseListener(gearsMouse);
+ } else if (GLProfile.isAWTAvailable() && drawable instanceof java.awt.Component) {
+ java.awt.Component comp = (java.awt.Component) drawable;
+ new AWTMouseAdapter(gearsMouse).addTo(comp);
}
}
@@ -154,9 +114,10 @@ public class Gears implements GLEventListener {
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
- if ((drawable instanceof GLJPanel) &&
- !((GLJPanel) drawable).isOpaque() &&
- ((GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
+ if (GLProfile.isAWTAvailable() &&
+ (drawable instanceof javax.media.opengl.awt.GLJPanel) &&
+ !((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() &&
+ ((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
gl.glClear(GL2.GL_DEPTH_BUFFER_BIT);
} else {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
@@ -335,8 +296,8 @@ public class Gears implements GLEventListener {
Window window = (Window) source;
width=window.getWidth();
height=window.getHeight();
- } else if (source instanceof Component) {
- Component comp = (Component) source;
+ } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
+ java.awt.Component comp = (java.awt.Component) source;
width=comp.getWidth();
height=comp.getHeight();
} else {
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 60435cb4a..9639c384b 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
@@ -37,6 +37,7 @@ import com.jogamp.newt.event.TraceKeyAdapter;
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;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java
index 1589be84c..f88d4d16f 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java
@@ -26,23 +26,25 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.demos.gl2.gears;
+package com.jogamp.test.junit.jogl.demos.gl2.gears.newt;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.test.junit.util.UITestCase;
+import com.jogamp.test.junit.util.QuitAdapter;
-import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-import com.jogamp.newt.*;
-import com.jogamp.newt.event.*;
-import com.jogamp.newt.opengl.*;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLRunnable;
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 TestGearsNEWT extends UITestCase {
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java
index be1e5a58b..c965d5c21 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java
@@ -26,13 +26,14 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.demos.gl2.gears;
+package com.jogamp.test.junit.jogl.demos.gl2.gears.newt;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
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 com.jogamp.newt.*;
import com.jogamp.newt.event.*;
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
index 326a6942a..79d899b6c 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.awt;
+package com.jogamp.test.junit.jogl.newt;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.test.junit.util.*;
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java b/src/junit/com/jogamp/test/junit/util/DumpVersion.java
index 3fa7f111f..df07c5bcf 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java
+++ b/src/junit/com/jogamp/test/junit/util/DumpVersion.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.acore;
+package com.jogamp.test.junit.util;
import org.junit.Assert;
import org.junit.Before;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java b/src/junit/com/jogamp/test/junit/util/QuitAdapter.java
index e60543b7c..258132582 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/QuitAdapter.java
@@ -26,12 +26,12 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.test.junit.jogl.demos.gl2.gears;
+package com.jogamp.test.junit.util;
import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.event.*;
-class QuitAdapter extends WindowAdapter implements WindowListener, KeyListener {
+public class QuitAdapter extends WindowAdapter implements WindowListener, KeyListener {
boolean shouldQuit = false;
public boolean shouldQuit() { return shouldQuit; }