diff options
author | Sven Gothel <[email protected]> | 2010-12-19 01:04:38 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-12-19 01:04:38 +0100 |
commit | 3f92d13a9f886b044f8f1c49ff22476e30ba408d (patch) | |
tree | 40b6ec2cb6c74577f573da9267287bad3fc3b0d7 /src/demos/gears | |
parent | df1bf4aa61c75bc27b630d58691aa9ee09ad046e (diff) |
Unique ZIP archive name ; Gears main init sequence
Diffstat (limited to 'src/demos/gears')
-rw-r--r-- | src/demos/gears/Gears.java | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index 88de5c9..589ef8e 100644 --- a/src/demos/gears/Gears.java +++ b/src/demos/gears/Gears.java @@ -7,6 +7,7 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.newt.event.*; import com.jogamp.newt.event.awt.*; +import java.awt.BorderLayout; import java.awt.Component; import java.awt.Frame; import com.jogamp.newt.Window; @@ -19,6 +20,9 @@ import com.jogamp.newt.Window; */ public class Gears implements GLEventListener { + static { + GLProfile.initSingleton(false); + } private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; private int gear1, gear2, gear3; private float angle = 0.0f; @@ -31,20 +35,13 @@ public class Gears implements GLEventListener { // <application-desc main-class="demos.j2d.TextCube"/> // <argument>NotFirstUIActionOnProcess</argument> // </application-desc> - boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; - GLProfile.initSingleton(firstUIActionOnProcess); + // boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; 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.setLayout(new BorderLayout()); + + final Animator animator = new Animator(); 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 @@ -58,6 +55,18 @@ public class Gears implements GLEventListener { }).start(); } }); + + GLCanvas canvas = new GLCanvas(); + animator.add(canvas); + // GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + // GLCanvas canvas = new GLCanvas(caps); + + final Gears gears = new Gears(); + canvas.addGLEventListener(gears); + + frame.add(canvas, BorderLayout.CENTER); + frame.validate(); + frame.setVisible(true); animator.start(); } |