diff options
author | Sven Gothel <[email protected]> | 2011-09-15 15:08:38 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-15 15:08:38 +0200 |
commit | ed6fcf8543f9116c8e0bc9e5220b6b0158c3a4ed (patch) | |
tree | c3e41e78faddb1dc7d4a502c6bc3f407cb335e71 /src/newt | |
parent | 54b92eb3240d3d6e4686faf48504e1ecfb385869 (diff) |
JOGLNewtApplet1Run: Add gl_alpha, gl_multisamplebuffer and gl_nodefaultkeylistener ; Cleanup
Diffstat (limited to 'src/newt')
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java | 17 | ||||
-rwxr-xr-x | src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 37 |
2 files changed, 28 insertions, 26 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java index 64ac66504..38a3d952d 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -7,6 +7,7 @@ import java.awt.event.MouseMotionListener; import java.awt.event.KeyListener; import javax.media.opengl.*; + import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; import java.awt.BorderLayout; @@ -40,11 +41,14 @@ import java.awt.BorderLayout; <param name="gl_swap_interval" value="1"> <param name="gl_undecorated" value="true"> <param name="gl_alwaysontop" value="true"> + <param name="gl_alpha" value="1"> + <param name="gl_multisamplebuffer" value="0"> <param name="gl_opaque" value="false"> <param name="gl_dx" value="10"> <param name="gl_dy" value="0"> <param name="gl_width" value="100"> <param name="gl_height" value="100"> + <param name="gl_nodefaultkeyListener" value="true"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> @@ -75,6 +79,9 @@ public class JOGLNewtApplet1Run extends Applet { boolean glUndecorated=false; boolean glAlwaysOnTop=false; boolean glOpaque=true; + int glAlphaBits=0; + int glNumMultisampleBuffer=0; + boolean glNoDefaultKeyListener = false; try { glEventListenerClazzName = getParameter("gl_event_listener_class"); glProfileName = getParameter("gl_profile"); @@ -84,10 +91,13 @@ public class JOGLNewtApplet1Run extends Applet { glUndecorated = JOGLNewtAppletBase.str2Bool(getParameter("gl_undecorated"), glUndecorated); glAlwaysOnTop = JOGLNewtAppletBase.str2Bool(getParameter("gl_alwaysontop"), glAlwaysOnTop); glOpaque = JOGLNewtAppletBase.str2Bool(getParameter("gl_opaque"), glOpaque); + glAlphaBits = JOGLNewtAppletBase.str2Int(getParameter("gl_alpha"), glAlphaBits); + glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer); glXd = JOGLNewtAppletBase.str2Int(getParameter("gl_dx"), glXd); glYd = JOGLNewtAppletBase.str2Int(getParameter("gl_dy"), glYd); glWidth = JOGLNewtAppletBase.str2Int(getParameter("gl_width"), glWidth); glHeight = JOGLNewtAppletBase.str2Int(getParameter("gl_height"), glHeight); + glNoDefaultKeyListener = JOGLNewtAppletBase.str2Bool(getParameter("gl_nodefaultkeyListener"), glNoDefaultKeyListener); } catch (Exception e) { e.printStackTrace(); } @@ -98,14 +108,21 @@ public class JOGLNewtApplet1Run extends Applet { base = new JOGLNewtAppletBase(glEventListenerClazzName, glSwapInterval, + glNoDefaultKeyListener, glDebug, glTrace); try { GLProfile.initSingleton(false); GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); + caps.setAlphaBits(glAlphaBits); + if(0<glNumMultisampleBuffer) { + caps.setSampleBuffers(true); + caps.setNumSamples(glNumMultisampleBuffer); + } caps.setBackgroundOpaque(glOpaque); glWindow = GLWindow.create(caps); + glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); glWindow.setUndecorated(glUndecorated); glWindow.setAlwaysOnTop(glAlwaysOnTop); if(glStandalone) { diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java index 9d3b8185f..c6240d1f9 100755 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java @@ -6,6 +6,7 @@ import java.security.PrivilegedAction; import javax.media.nativewindow.NativeWindow; import javax.media.opengl.*; + import com.jogamp.opengl.util.*; import com.jogamp.newt.event.*; @@ -14,9 +15,10 @@ 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. */ -public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, MouseListener, GLEventListener { +public class JOGLNewtAppletBase implements KeyListener, GLEventListener { String glEventListenerClazzName; int glSwapInterval; + boolean noDefaultKeyListener; boolean glDebug; boolean glTrace; @@ -28,11 +30,13 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo public JOGLNewtAppletBase(String glEventListenerClazzName, int glSwapInterval, + boolean noDefaultKeyListener, boolean glDebug, boolean glTrace) { this.glEventListenerClazzName=glEventListenerClazzName; this.glSwapInterval=glSwapInterval; + this.noDefaultKeyListener = noDefaultKeyListener; this.glDebug = glDebug; this.glTrace = glTrace; } @@ -129,22 +133,25 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo 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); + + if(!noDefaultKeyListener) { + glWindow.addKeyListener(this); + } glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); // glAnimator = new FPSAnimator(canvas, 60); glAnimator = new Animator(tg, glWindow); + glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null); + } catch (Throwable t) { throw new RuntimeException(t); } @@ -233,27 +240,5 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo } } } - - // *********************************************************************************** - // *********************************************************************************** - // *********************************************************************************** - - public void mouseClicked(MouseEvent e) { - } - public void mouseEntered(MouseEvent e) { - } - public void mouseExited(MouseEvent e) { - } - public void mousePressed(MouseEvent e) { - } - public void mouseReleased(MouseEvent e) { - } - public void mouseMoved(MouseEvent e) { - } - public void mouseDragged(MouseEvent e) { - } - public void mouseWheelMoved(MouseEvent e) { - } - } |