diff options
author | Sven Gothel <[email protected]> | 2009-09-14 11:45:30 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-09-14 11:45:30 -0700 |
commit | 0afab6a652471cf1c140d3affe6ae442ab217ff1 (patch) | |
tree | b515e3913c878ccb07c4c246be06c51b91200469 | |
parent | e7003e596519e225ecec5b4423314c4dcaa05db8 (diff) |
Fixes and tested JOGLNewtApplet1Run/JOGLNewtAppletBase
-rw-r--r-- | jnlp-files/applet-gears-jnlp.html | 19 | ||||
-rw-r--r-- | jnlp-files/applet-gears.jnlp | 26 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html | 25 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-cube.html | 25 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-fbcubes.html | 25 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-gears.html | 25 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner.jnlp | 25 | ||||
-rwxr-xr-x | src/demos/applets/JOGLNewtApplet1Run.java | 16 | ||||
-rwxr-xr-x | src/demos/applets/JOGLNewtAppletBase.java | 36 | ||||
-rwxr-xr-x | src/demos/es1/angeles/AngelesES1.java | 4 | ||||
-rwxr-xr-x | src/demos/es1/angeles/AngelesGL.java | 4 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/FBCubes.java | 2 |
12 files changed, 211 insertions, 21 deletions
diff --git a/jnlp-files/applet-gears-jnlp.html b/jnlp-files/applet-gears-jnlp.html new file mode 100644 index 0000000..64a16d9 --- /dev/null +++ b/jnlp-files/applet-gears-jnlp.html @@ -0,0 +1,19 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<title>JOGL JNLP Applet Gears</title> +</head> +<body> + +<P> + +<applet width=600 height=400> + <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> + <param name="jnlp_href" value="applet-gears.jnlp"> +</applet> + +</P> +<P> + +</body> +</html> diff --git a/jnlp-files/applet-gears.jnlp b/jnlp-files/applet-gears.jnlp new file mode 100644 index 0000000..9234dcd --- /dev/null +++ b/jnlp-files/applet-gears.jnlp @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp codebase="DEMO_CODEBASE_TAG" href="applet-gears.jnlp"> + <information> + <title>JOGL JNLP Applet Gears Demo</title> + <vendor>Sun Microsystems, Inc.</vendor> + <homepage href="http://jogl-demos.dev.java.net/"/> + <description>Gears Demo </description> + <description kind="short">Brian Paul's Gears demo ported to Java and JOGL.</description> + <offline-allowed/> + </information> + + <resources> + <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/> + <property name="sun.java2d.noddraw" value="true"/> + <jar href="jogl-demos.jar" main="true"/> + <jar href="jogl-demos-util.jar"/> + <extension name="jogl-all-awt" href="JOGL_CODEBASE_TAG/jogl-all-awt.jnlp" /> + </resources> + + <applet-desc + name="Gears-Applet" + main-class="demos.applets.GearsApplet" + width="640" + height="480"> + </applet-desc> +</jnlp> diff --git a/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html b/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html new file mode 100644 index 0000000..067b918 --- /dev/null +++ b/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<title>JOGL NEWT JNLP Applet Runner - GL2ES1 Angeles</title> +</head> +<body> + +<P> + +<applet width=600 height=400> + <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> + <param name="gl_event_listener_class" value="demos.es1.angeles.AngelesGL"> + <param name="gl_profile" value="GL2ES1"> + <param name="gl_swap_interval" value="1"> + <param name="gl_use_in_events" value="false"> + <param name="gl_debug" value="false"> + <param name="gl_trace" value="false"> + <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> +</applet> + +</P> +<P> + +</body> +</html> diff --git a/jnlp-files/jogl-newt-applet-runner-cube.html b/jnlp-files/jogl-newt-applet-runner-cube.html new file mode 100644 index 0000000..09ffab0 --- /dev/null +++ b/jnlp-files/jogl-newt-applet-runner-cube.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<title>JOGL NEWT JNLP Applet Runner - ES1 Cube</title> +</head> +<body> + +<P> + +<applet width=600 height=400> + <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> + <param name="gl_event_listener_class" value="demos.es1.cube.Cube"> + <param name="gl_profile" value="GL2ES1"> + <param name="gl_swap_interval" value="1"> + <param name="gl_use_in_events" value="false"> + <param name="gl_debug" value="false"> + <param name="gl_trace" value="false"> + <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> +</applet> + +</P> +<P> + +</body> +</html> diff --git a/jnlp-files/jogl-newt-applet-runner-fbcubes.html b/jnlp-files/jogl-newt-applet-runner-fbcubes.html new file mode 100644 index 0000000..9a47614 --- /dev/null +++ b/jnlp-files/jogl-newt-applet-runner-fbcubes.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<title>JOGL NEWT JNLP Applet Runner - ES1 FBO Cubes</title> +</head> +<body> + +<P> + +<applet width=600 height=400> + <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> + <param name="gl_event_listener_class" value="demos.es1.cubefbo.FBCubes"> + <param name="gl_profile" value="GL2ES1"> + <param name="gl_swap_interval" value="1"> + <param name="gl_use_in_events" value="false"> + <param name="gl_debug" value="false"> + <param name="gl_trace" value="false"> + <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> +</applet> + +</P> +<P> + +</body> +</html> diff --git a/jnlp-files/jogl-newt-applet-runner-gears.html b/jnlp-files/jogl-newt-applet-runner-gears.html new file mode 100644 index 0000000..da05b53 --- /dev/null +++ b/jnlp-files/jogl-newt-applet-runner-gears.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<html> +<head> +<title>JOGL NEWT JNLP Applet Runner - Gears</title> +</head> +<body> + +<P> + +<applet width=600 height=400> + <param name="java_arguments" value="-Dsun.java2d.noddraw=true"> + <param name="gl_event_listener_class" value="demos.gears.Gears"> + <param name="gl_profile" value="GL2"> + <param name="gl_swap_interval" value="1"> + <param name="gl_use_in_events" value="false"> + <param name="gl_debug" value="false"> + <param name="gl_trace" value="false"> + <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> +</applet> + +</P> +<P> + +</body> +</html> diff --git a/jnlp-files/jogl-newt-applet-runner.jnlp b/jnlp-files/jogl-newt-applet-runner.jnlp new file mode 100644 index 0000000..ebeaefa --- /dev/null +++ b/jnlp-files/jogl-newt-applet-runner.jnlp @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<jnlp codebase="DEMO_CODEBASE_TAG" href="jogl-newt-applet-runner.jnlp"> + <information> + <title>JOGL NEWT JNLP Applet Runner</title> + <vendor>Sun Microsystems, Inc.</vendor> + <homepage href="http://jogl-demos.dev.java.net/"/> + <description>JOGL NEWT JNLP Applet Runner</description> + <offline-allowed/> + </information> + + <resources> + <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/> + <property name="sun.java2d.noddraw" value="true"/> + <jar href="jogl-demos.jar" main="true"/> + <jar href="jogl-demos-util.jar"/> + <extension name="jogl-all-awt" href="JOGL_CODEBASE_TAG/newt-all-awt.jnlp" /> + </resources> + + <applet-desc + name="JOGLNewtApplet2Run-Applet" + main-class="demos.applets.JOGLNewtApplet1Run" + width="640" + height="480"> + </applet-desc> +</jnlp> diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java index 08522de..6ea3251 100755 --- a/src/demos/applets/JOGLNewtApplet1Run.java +++ b/src/demos/applets/JOGLNewtApplet1Run.java @@ -2,6 +2,9 @@ package demos.applets; import java.applet.*; import java.awt.Container; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.KeyListener; import javax.media.opengl.*; import javax.media.nativewindow.*; @@ -60,6 +63,19 @@ public class JOGLNewtApplet1Run extends Applet { if(null!=nWindow) { base.init(nWindow); } + if(base.isValid()) { + GLEventListener glEventListener = base.getGLEventListener(); + + if(glEventListener instanceof MouseListener) { + addMouseListener((MouseListener)glEventListener); + } + if(glEventListener instanceof MouseMotionListener) { + addMouseMotionListener((MouseMotionListener)glEventListener); + } + if(glEventListener instanceof KeyListener) { + addKeyListener((KeyListener)glEventListener); + } + } } catch (Throwable t) { throw new RuntimeException(t); } diff --git a/src/demos/applets/JOGLNewtAppletBase.java b/src/demos/applets/JOGLNewtAppletBase.java index a1ea482..4246e4a 100755 --- a/src/demos/applets/JOGLNewtAppletBase.java +++ b/src/demos/applets/JOGLNewtAppletBase.java @@ -21,10 +21,10 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis boolean glDebug; boolean glTrace; + GLEventListener glEventListener = null; GLWindow glWindow = null; Animator glAnimator=null; boolean isValid = false; - boolean quit = false; public JOGLNewtAppletBase(String glEventListenerClazzName, String glProfileName, @@ -43,10 +43,10 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis this.glTrace = glTrace; } + public GLEventListener getGLEventListener() { return glEventListener; } public GLWindow getGLWindow() { return glWindow; } public Animator getGLAnimator() { return glAnimator; } public boolean isValid() { return isValid; } - public boolean shouldQuit() { return quit; } public static boolean str2Bool(String str, boolean def) { if(null==str) return def; @@ -101,7 +101,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } public void init(Window nWindow) { - GLEventListener glEventListener = createInstance(glEventListenerClazzName); + glEventListener = createInstance(glEventListenerClazzName); try { glWindow = GLWindow.create(nWindow); @@ -112,9 +112,22 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis glWindow.addGLEventListener(this); glWindow.addGLEventListener(glEventListener); + + if(glEventListener instanceof WindowListener) { + glWindow.addWindowListener((WindowListener)glEventListener); + } glWindow.addWindowListener(this); + + if(glEventListener instanceof MouseListener) { + glWindow.addMouseListener((MouseListener)glEventListener); + } glWindow.addMouseListener(this); + + if(glEventListener instanceof KeyListener) { + glWindow.addKeyListener((KeyListener)glEventListener); + } glWindow.addKeyListener(this); + glWindow.setEventHandlerMode( useGLInEventHandler ? GLWindow.EVENT_HANDLER_GL_CURRENT : GLWindow.EVENT_HANDLER_GL_NONE ); glWindow.setRunPumpMessages(handleWindowEvents); glWindow.setVisible(true); @@ -141,7 +154,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } public void destroy() { - quit = true; isValid = false; if(null!=glAnimator) { glAnimator.stop(); @@ -196,7 +208,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } public void windowDestroyNotify(WindowEvent e) { - quit=true; } public void windowGainedFocus(WindowEvent e) { } public void windowLostFocus(WindowEvent e) { } @@ -207,11 +218,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public void keyPressed(KeyEvent e) { System.out.println(e); - if(e.getKeyChar()=='f') { - glWindow.setFullscreen(!glWindow.isFullscreen()); - } else if(e.getKeyChar()=='q') { - quit = true; - } } public void keyReleased(KeyEvent e) { System.out.println(e); @@ -226,16 +232,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public void mouseClicked(MouseEvent e) { System.out.println(" mouseevent: "+e); - switch(e.getClickCount()) { - case 1: - if(e.getButton()>MouseEvent.BUTTON1) { - glWindow.setFullscreen(!glWindow.isFullscreen()); - } - break; - default: - quit=true; - break; - } } public void mouseEntered(MouseEvent e) { } diff --git a/src/demos/es1/angeles/AngelesES1.java b/src/demos/es1/angeles/AngelesES1.java index c5de891..bfb4a78 100755 --- a/src/demos/es1/angeles/AngelesES1.java +++ b/src/demos/es1/angeles/AngelesES1.java @@ -31,6 +31,10 @@ import java.nio.*; public class AngelesES1 implements GLEventListener { + public AngelesES1() { + this(true); + } + public AngelesES1(boolean enableBlending) { blendingEnabled = enableBlending; quadVertices = BufferUtil.newIntBuffer(12); diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java index bae7b5c..12206de 100755 --- a/src/demos/es1/angeles/AngelesGL.java +++ b/src/demos/es1/angeles/AngelesGL.java @@ -32,6 +32,10 @@ import java.nio.*; public class AngelesGL implements GLEventListener { + public AngelesGL() { + this(true); + } + public AngelesGL(boolean enableBlending) { blendingEnabled = enableBlending; quadVertices = BufferUtil.newFloatBuffer(12); diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java index ad4e120..ecef02d 100755 --- a/src/demos/es1/cubefbo/FBCubes.java +++ b/src/demos/es1/cubefbo/FBCubes.java @@ -39,7 +39,7 @@ import javax.media.opengl.*; import com.sun.opengl.util.FBObject; import com.sun.opengl.util.glsl.fixedfunc.*; -class FBCubes implements GLEventListener { +public class FBCubes implements GLEventListener { private static final int FBO_SIZE = 256; public FBCubes () { |