aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-15 13:26:06 +0200
committerSven Gothel <[email protected]>2011-09-15 13:26:06 +0200
commitbaa88fe536b0b8a70cadabe5412120a9168dec11 (patch)
treead76ec6b15e41bbfbdba1e51fc5604bbe63393c7 /src/test
parent42129070c5262c7f6c881c41a70fcb4550c33efa (diff)
JOGLNewtAppletBase: Use proper context ClassLoader; Add ElektronenMultiplizierer (NEWT Applet Runner)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java9
2 files changed, 25 insertions, 9 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
index 0e43a71b1..6fec015b0 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
@@ -42,6 +42,9 @@ import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
@@ -153,6 +156,17 @@ public class ElektronenMultiplizierer implements GLEventListener {
public boolean wantsFrameSkip() { return mCommandLineParameter_FrameSkip; }
public boolean usesFullScreenMode() { return mUsesFullScreenMode; }
+ class TimeShiftKeys extends KeyAdapter {
+ public void keyPressed(KeyEvent e) {
+ if(KeyEvent.VK_RIGHT == e.getKeyCode()) {
+ skipFrames(120);
+ } else if(KeyEvent.VK_LEFT == e.getKeyCode()) {
+ skipFrames(-120);
+ }
+ }
+ }
+ TimeShiftKeys timeShiftKeys;
+
public ElektronenMultiplizierer (
String inBaseRoutineClassName,
boolean inMultiSampling,
@@ -187,6 +201,11 @@ public class ElektronenMultiplizierer implements GLEventListener {
mFrameSkipAverageFramerateTimeStart = 0;
mFrameCounter = 0;
skipFrames(startFrame);
+ timeShiftKeys = new TimeShiftKeys();
+ }
+
+ public ElektronenMultiplizierer() {
+ this(null, false, -1, false, -1.0f, false, true, 30, 0);
}
/**
@@ -204,6 +223,12 @@ public class ElektronenMultiplizierer implements GLEventListener {
}
public void init(GLAutoDrawable drawable) {
+ if(drawable instanceof GLWindow) {
+ final GLWindow glw = (GLWindow) drawable;
+ if ( glw.getKeyListener(0) != timeShiftKeys ) {
+ glw.addKeyListener(0, timeShiftKeys);
+ }
+ }
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.setSwapInterval(1);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
index 26917107d..d9cee4fdf 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
@@ -114,15 +114,6 @@ public class TestElektronenMultipliziererNEWT extends UITestCase {
} }.start();
}
}
- public void keyPressed(KeyEvent e) {
- if(KeyEvent.VK_RIGHT == e.getKeyCode()) {
- demo.skipFrames(120);
- System.err.println("->");
- } else if(KeyEvent.VK_LEFT == e.getKeyCode()) {
- demo.skipFrames(-120);
- System.err.println("<-");
- }
- }
});
glWindow.setVisible(true);