diff options
author | Sven Gothel <[email protected]> | 2010-10-14 21:34:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-14 21:34:27 +0200 |
commit | 1ff81eb806d6df78994a808217eb2c5f6b4ef8da (patch) | |
tree | 7ae11fd92f63019c6c54862c66eb2656bcc2ef97 /src/demos/applets | |
parent | 0d1ea8ae8eb940b1b29f4f80c232a1d456300362 (diff) |
Fix/Syn with JOGL 774138544e1eec3330309ad682fa05154a07ab8d ; Notably add: Applet's with native NEWT support, ie jogl-newt-applet-runner-gears.html
Diffstat (limited to 'src/demos/applets')
-rwxr-xr-x | src/demos/applets/GearsApplet.java | 4 | ||||
-rwxr-xr-x | src/demos/applets/GearsJOALApplet.java | 4 | ||||
-rwxr-xr-x | src/demos/applets/JOGLNewtApplet1Run.java | 1 | ||||
-rwxr-xr-x | src/demos/applets/JOGLNewtAppletBase.java | 31 |
4 files changed, 26 insertions, 14 deletions
diff --git a/src/demos/applets/GearsApplet.java b/src/demos/applets/GearsApplet.java index 811eafe..73bef96 100755 --- a/src/demos/applets/GearsApplet.java +++ b/src/demos/applets/GearsApplet.java @@ -12,12 +12,10 @@ import javax.media.opengl.GLAnimatorControl; referenced from a web page via an <applet> tag. */ public class GearsApplet extends Applet { - static { - GLProfile.initSingleton(); - } private GLAnimatorControl animator; public void init() { + GLProfile.initSingleton(false); setLayout(new BorderLayout()); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Gears()); diff --git a/src/demos/applets/GearsJOALApplet.java b/src/demos/applets/GearsJOALApplet.java index bf36e1b..dc2b946 100755 --- a/src/demos/applets/GearsJOALApplet.java +++ b/src/demos/applets/GearsJOALApplet.java @@ -16,12 +16,10 @@ import javax.media.opengl.GLAnimatorControl; must be referenced from a web page via an <applet> tag. */ public class GearsJOALApplet extends Applet { - static { - GLProfile.initSingleton(); - } private GLAnimatorControl animator; public void init() { + GLProfile.initSingleton(false); setLayout(new GridLayout(1, 2)); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Gears()); diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java index df42da6..936e7b9 100755 --- a/src/demos/applets/JOGLNewtApplet1Run.java +++ b/src/demos/applets/JOGLNewtApplet1Run.java @@ -49,6 +49,7 @@ public class JOGLNewtApplet1Run extends Applet { glTrace); try { + GLProfile.initSingleton(false); GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); glWindow = GLWindow.create(caps); newtCanvasAWT = new NewtCanvasAWT(glWindow); diff --git a/src/demos/applets/JOGLNewtAppletBase.java b/src/demos/applets/JOGLNewtAppletBase.java index e07f34f..da8565c 100755 --- a/src/demos/applets/JOGLNewtAppletBase.java +++ b/src/demos/applets/JOGLNewtAppletBase.java @@ -2,12 +2,13 @@ package demos.applets; import java.lang.reflect.*; -import com.jogamp.newt.event.*; -import com.jogamp.newt.opengl.GLWindow; - +import javax.media.nativewindow.NativeWindow; import javax.media.opengl.*; import com.jogamp.opengl.util.*; +import com.jogamp.newt.event.*; +import com.jogamp.newt.opengl.GLWindow; + /** Shows how to deploy an applet using JOGL. This demo must be referenced from a web page via an <applet> tag. */ @@ -21,6 +22,7 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo GLWindow glWindow = null; Animator glAnimator=null; boolean isValid = false; + NativeWindow awtParent; public JOGLNewtAppletBase(String glEventListenerClazzName, int glSwapInterval, @@ -95,6 +97,8 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo } public void init(ThreadGroup tg, GLWindow glWindow) { + this.glWindow = glWindow; + glEventListener = createInstance(glEventListenerClazzName); try { @@ -134,6 +138,10 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo if(isValid) { glWindow.setVisible(true); glAnimator.start(); + awtParent = glWindow.getParent(); + if(null==awtParent) { + throw new RuntimeException("Parent of GLWindow is null: "+glWindow); + } } } @@ -193,13 +201,21 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo // *********************************************************************************** public void keyPressed(KeyEvent e) { - System.out.println(e); } public void keyReleased(KeyEvent e) { - System.out.println(e); } - public void keyTyped(KeyEvent e) { - System.out.println(e); + public void keyTyped(KeyEvent e) { + if(e.getKeyChar()=='d') { + glWindow.setUndecorated(!glWindow.isUndecorated()); + } if(e.getKeyChar()=='f') { + glWindow.setFullscreen(!glWindow.isFullscreen()); + } else if(e.getKeyChar()=='r') { + if(null == glWindow.getParent()) { + glWindow.reparentWindow(awtParent); + } else { + glWindow.reparentWindow(null); + } + } } // *********************************************************************************** @@ -207,7 +223,6 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo // *********************************************************************************** public void mouseClicked(MouseEvent e) { - System.out.println(" mouseevent: "+e); } public void mouseEntered(MouseEvent e) { } |