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 | |
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')
42 files changed, 376 insertions, 225 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) { } diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java index db263af..f77effd 100644 --- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java +++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java @@ -49,10 +49,6 @@ import java.io.*; */ public class cgGL_vertex_example implements GLEventListener { - static { - GLProfile.initSingleton(); - } - /******************************************************************************/ /*** Static Data ***/ /******************************************************************************/ @@ -274,6 +270,13 @@ public class cgGL_vertex_example implements GLEventListener public static void main(String[] argv) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==argv.length || !argv[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + // GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); // GLCanvas canvas = new GLCanvas(caps); GLCanvas canvas = new GLCanvas(); diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java index 6502720..d902808 100644 --- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java +++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java @@ -53,10 +53,6 @@ import java.util.*; */ public class runtime_ogl_vertex_fragment implements GLEventListener { - static { - GLProfile.initSingleton(); - } - // Global variables: hold the Cg context that we're storing our programs // in as well as handles to the vertex and fragment program used in this // demo. @@ -72,6 +68,13 @@ public class runtime_ogl_vertex_fragment implements GLEventListener public static void main(String[] argv) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==argv.length || !argv[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + Frame frame = new Frame("Cg demo (runtime_ogl_vertex_fragment)"); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new runtime_ogl_vertex_fragment()); diff --git a/src/demos/cubefbo/FBCubes.java b/src/demos/cubefbo/FBCubes.java index 99ed710..14aca21 100755 --- a/src/demos/cubefbo/FBCubes.java +++ b/src/demos/cubefbo/FBCubes.java @@ -49,10 +49,6 @@ import com.jogamp.opengl.util.FBObject; class FBCubes implements GLEventListener, MouseListener, MouseMotionListener { - static { - GLProfile.initSingleton(); - } - private static final int FBO_SIZE = 128; public FBCubes () { diff --git a/src/demos/cubefbo/Main.java b/src/demos/cubefbo/Main.java index fc87840..bebe89e 100755 --- a/src/demos/cubefbo/Main.java +++ b/src/demos/cubefbo/Main.java @@ -45,11 +45,13 @@ import javax.media.opengl.GLAnimatorControl; public class Main { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); GLCapabilities caps = new GLCapabilities(null); GLCanvas canvas = new GLCanvas(caps); diff --git a/src/demos/fullscreen/GearsFullscreen.java b/src/demos/fullscreen/GearsFullscreen.java index 2fa9937..eaded8e 100755 --- a/src/demos/fullscreen/GearsFullscreen.java +++ b/src/demos/fullscreen/GearsFullscreen.java @@ -22,10 +22,6 @@ import com.jogamp.opengl.util.Animator; */ public class GearsFullscreen { - static { - GLProfile.initSingleton(); - } - private GraphicsDevice dev; private DisplayMode origMode; private boolean fullScreen; @@ -35,6 +31,13 @@ public class GearsFullscreen { private int initHeight = 300; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new GearsFullscreen().run(args); } diff --git a/src/demos/fullscreen/GearsFullscreen2.java b/src/demos/fullscreen/GearsFullscreen2.java index 1984acc..1d3df0a 100755 --- a/src/demos/fullscreen/GearsFullscreen2.java +++ b/src/demos/fullscreen/GearsFullscreen2.java @@ -31,10 +31,6 @@ import javax.swing.ToolTipManager; */ public class GearsFullscreen2 { - static { - GLProfile.initSingleton(); - } - private GraphicsDevice dev; private DisplayMode origMode; private boolean fullScreen; @@ -44,6 +40,13 @@ public class GearsFullscreen2 { private int initHeight = 300; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new GearsFullscreen2().run(args); } diff --git a/src/demos/gamma/TestGamma.java b/src/demos/gamma/TestGamma.java index fc6a34f..e8e46b5 100755 --- a/src/demos/gamma/TestGamma.java +++ b/src/demos/gamma/TestGamma.java @@ -51,10 +51,6 @@ import com.jogamp.opengl.util.Gamma; public class TestGamma implements GLEventListener { - static { - GLProfile.initSingleton(); - } - private static void usage() { System.out.println("Usage: java TestGamma [gamma value] [brightness value] [contrast value]"); System.exit(1); @@ -84,6 +80,8 @@ public class TestGamma implements GLEventListener { } public static void main(String[] args) { + GLProfile.initSingleton(true); + if (args.length != 3) { usage(); } diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index 33446c7..88de5c9 100644 --- a/src/demos/gears/Gears.java +++ b/src/demos/gears/Gears.java @@ -1,23 +1,15 @@ + package demos.gears; -import java.awt.Dimension; -import java.awt.Frame; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import javax.media.opengl.GLProfile; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GL2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.awt.AWTGLAutoDrawable; -import javax.media.opengl.awt.GLCanvas; -import javax.media.opengl.awt.GLJPanel; +import javax.media.opengl.*; +import javax.media.opengl.awt.*; import com.jogamp.opengl.util.Animator; +import com.jogamp.newt.event.*; +import com.jogamp.newt.event.awt.*; + +import java.awt.Component; +import java.awt.Frame; +import com.jogamp.newt.Window; /** * Gears.java <BR> @@ -26,10 +18,21 @@ import com.jogamp.opengl.util.Animator; * This version is equal to Brian Paul's version 1.2 1999/10/21 */ -public class Gears implements GLEventListener, MouseListener, MouseMotionListener { +public class Gears implements GLEventListener { + private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; + private int gear1, gear2, gear3; + private float angle = 0.0f; + + private int prevMouseX, prevMouseY; + private boolean mouseRButtonDown = false; + public static void main(String[] args) { - // RTFM .. essential for multithreading. - GLProfile.initSingleton(); + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); Frame frame = new Frame("Gear Demo"); GLCanvas canvas = new GLCanvas(); @@ -42,8 +45,8 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene frame.add(canvas); frame.setSize(300, 300); final Animator animator = new Animator(canvas); - frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + 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 // make sure the call to Animator.stop() completes before // exiting @@ -59,22 +62,18 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene animator.start(); } - private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; - private int gear1, gear2, gear3; - private float angle = 0.0f; - - private int prevMouseX, prevMouseY; - private boolean mouseRButtonDown = false; - public void init(GLAutoDrawable drawable) { + System.err.println("Gears: Init: "+drawable); // Use debug pipeline // drawable.setGL(new DebugGL(drawable.getGL())); GL2 gl = drawable.getGL().getGL2(); - System.err.println("INIT GL IS: " + gl.getClass().getName()); - System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities()); + System.err.println("INIT GL IS: " + gl.getClass().getName()); + System.err.println("GL_VENDOR: " + gl.glGetString(GL2.GL_VENDOR)); + System.err.println("GL_RENDERER: " + gl.glGetString(GL2.GL_RENDERER)); + System.err.println("GL_VERSION: " + gl.glGetString(GL2.GL_VERSION)); gl.setSwapInterval(1); @@ -110,23 +109,26 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene gl.glEnable(GL2.GL_NORMALIZE); - if (drawable instanceof AWTGLAutoDrawable) { - AWTGLAutoDrawable awtDrawable = (AWTGLAutoDrawable) drawable; - awtDrawable.addMouseListener(this); - awtDrawable.addMouseMotionListener(this); + // MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter()); + MouseListener gearsMouse = new GearsMouseAdapter(); + + if (drawable instanceof Component) { + Component comp = (Component) drawable; + new AWTMouseAdapter(gearsMouse).addTo(comp); + } else if (drawable instanceof Window) { + Window window = (Window) drawable; + window.addMouseListener(gearsMouse); } } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + System.err.println("Gears: Reshape: "+x+"/"+y+" "+width+"x"+height); GL2 gl = drawable.getGL().getGL2(); float h = (float)height / (float)width; gl.glMatrixMode(GL2.GL_PROJECTION); - System.err.println("GL_VENDOR: " + gl.glGetString(GL2.GL_VENDOR)); - System.err.println("GL_RENDERER: " + gl.glGetString(GL2.GL_RENDERER)); - System.err.println("GL_VERSION: " + gl.glGetString(GL2.GL_VERSION)); gl.glLoadIdentity(); gl.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); gl.glMatrixMode(GL2.GL_MODELVIEW); @@ -135,7 +137,7 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene } public void dispose(GLAutoDrawable drawable) { - System.out.println("Gears.dispose: "+drawable); + System.err.println("Gears: Dispose"); } public void display(GLAutoDrawable drawable) { @@ -188,8 +190,6 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene gl.glPopMatrix(); } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - public static void gear(GL2 gl, float inner_radius, float outer_radius, @@ -306,41 +306,45 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene gl.glEnd(); } - // Methods required for the implementation of MouseListener - public void mouseEntered(MouseEvent e) {} - public void mouseExited(MouseEvent e) {} - - public void mousePressed(MouseEvent e) { - prevMouseX = e.getX(); - prevMouseY = e.getY(); - if ((e.getModifiers() & e.BUTTON3_MASK) != 0) { - mouseRButtonDown = true; - } - } - - public void mouseReleased(MouseEvent e) { - if ((e.getModifiers() & e.BUTTON3_MASK) != 0) { - mouseRButtonDown = false; - } - } - - public void mouseClicked(MouseEvent e) {} - - // Methods required for the implementation of MouseMotionListener - public void mouseDragged(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); - Dimension size = e.getComponent().getSize(); - - float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)size.width); - float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)size.height); - - prevMouseX = x; - prevMouseY = y; + class GearsMouseAdapter extends MouseAdapter { + public void mousePressed(MouseEvent e) { + prevMouseX = e.getX(); + prevMouseY = e.getY(); + if ((e.getModifiers() & e.BUTTON3_MASK) != 0) { + mouseRButtonDown = true; + } + } + + public void mouseReleased(MouseEvent e) { + if ((e.getModifiers() & e.BUTTON3_MASK) != 0) { + mouseRButtonDown = false; + } + } + + public void mouseDragged(MouseEvent e) { + int x = e.getX(); + int y = e.getY(); + int width=0, height=0; + Object source = e.getSource(); + if(source instanceof Window) { + Window window = (Window) source; + width=window.getWidth(); + height=window.getHeight(); + } else if (source instanceof Component) { + Component comp = (Component) source; + width=comp.getWidth(); + height=comp.getHeight(); + } else { + throw new RuntimeException("Event source neither Window nor Component: "+source); + } + float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width); + float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height); + + prevMouseX = x; + prevMouseY = y; - view_rotx += thetaX; - view_roty += thetaY; + view_rotx += thetaX; + view_roty += thetaY; + } } - - public void mouseMoved(MouseEvent e) {} } diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java index d4748b4..4a16fab 100755 --- a/src/demos/hdr/HDR.java +++ b/src/demos/hdr/HDR.java @@ -49,9 +49,6 @@ import javax.swing.JOptionPane; */ public class HDR extends Demo { - static { - GLProfile.initSingleton(); - } private static String[] defaultArgs = { "demos/data/images/stpeters_cross.hdr", "512", @@ -134,6 +131,7 @@ public class HDR extends Demo { 0.0f, 0.0f, 0.0f, 1.0f }; public static void main(String[] args) { + GLProfile.initSingleton(false); GLCanvas canvas = new GLCanvas(); final HDR demo = new HDR(); @@ -260,8 +258,10 @@ public class HDR extends Demo { // public void shutdownDemo() { - ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable); - drawable.removeGLEventListener(this); + if(null!=drawable) { + ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable); + drawable.removeGLEventListener(this); + } super.shutdownDemo(); } diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index b22073a..b5b8f3b 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -56,6 +56,7 @@ import java.awt.event.WindowEvent; import java.io.IOException; import java.util.ArrayList; import javax.media.opengl.GLProfile; +import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; @@ -81,10 +82,14 @@ import javax.swing.JOptionPane; */ public class HWShadowmapsSimple extends Demo { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + final GLCanvas canvas = new GLCanvas(); final HWShadowmapsSimple demo = new HWShadowmapsSimple(); canvas.addGLEventListener(demo); @@ -205,8 +210,14 @@ public class HWShadowmapsSimple extends Demo { private int viewportY; public void init(GLAutoDrawable drawable) { - // Use debug pipeline - // drawable.setGL(new DebugGL(drawable.getGL().getGL2())); + // Use debug/trace pipeline + /** + GL _gl = drawable.getGL(); + // Debug .. + _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2.class, _gl, null) ); + // Trace .. + _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2.class, _gl, new Object[] { System.err } ) ); + */ GL2 gl = drawable.getGL().getGL2(); glu = new GLU(); diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java index 49404b3..eec06ff 100644 --- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java +++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java @@ -85,10 +85,14 @@ import javax.media.opengl.glu.GLU; */ public class InfiniteShadowVolumes extends Demo { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + GLCapabilities caps = new GLCapabilities(null); caps.setStencilBits(16); final GLCanvas canvas = new GLCanvas(caps); diff --git a/src/demos/j2d/CustomText.java b/src/demos/j2d/CustomText.java index 86a423f..5918dc9 100755 --- a/src/demos/j2d/CustomText.java +++ b/src/demos/j2d/CustomText.java @@ -86,10 +86,14 @@ import javax.swing.JPanel; to do text filled with a linear Java 2D gradient. */ public class CustomText extends Demo { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + JFrame frame = new JFrame("Custom Text"); frame.getContentPane().setLayout(new BorderLayout()); diff --git a/src/demos/j2d/FlyingText.java b/src/demos/j2d/FlyingText.java index d5a83a6..929803e 100755 --- a/src/demos/j2d/FlyingText.java +++ b/src/demos/j2d/FlyingText.java @@ -87,11 +87,14 @@ import javax.swing.event.ChangeListener; shadow effect. */ public class FlyingText extends Demo { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + JFrame frame = new JFrame("Flying Text"); frame.getContentPane().setLayout(new BorderLayout()); diff --git a/src/demos/j2d/TestOverlay.java b/src/demos/j2d/TestOverlay.java index 28c30fa..eda3e0a 100755 --- a/src/demos/j2d/TestOverlay.java +++ b/src/demos/j2d/TestOverlay.java @@ -66,10 +66,14 @@ import com.jogamp.opengl.util.Animator; with moving Java 2D-rendered text on top. */ public class TestOverlay implements GLEventListener { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + Frame frame = new Frame("Java 2D Overlay Test"); GLCapabilities caps = new GLCapabilities(null); caps.setAlphaBits(8); diff --git a/src/demos/j2d/TestTextRenderer.java b/src/demos/j2d/TestTextRenderer.java index d5ec735..53042dd 100755 --- a/src/demos/j2d/TestTextRenderer.java +++ b/src/demos/j2d/TestTextRenderer.java @@ -64,11 +64,14 @@ import com.jogamp.opengl.util.Animator; with moving Java 2D-rendered text on top. */ public class TestTextRenderer implements GLEventListener { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + Frame frame = new Frame("Text Renderer Test"); GLCapabilities caps = new GLCapabilities(null); caps.setAlphaBits(8); diff --git a/src/demos/j2d/TestTextureRenderer.java b/src/demos/j2d/TestTextureRenderer.java index 87baa1d..cedee83 100755 --- a/src/demos/j2d/TestTextureRenderer.java +++ b/src/demos/j2d/TestTextureRenderer.java @@ -70,11 +70,13 @@ import com.jogamp.opengl.util.Animator; underneath with moving Java 2D-rendered text on top. */ public class TestTextureRenderer implements GLEventListener { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); Frame frame = new Frame("Java 2D Renderer Test"); GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); diff --git a/src/demos/j2d/TextCube.java b/src/demos/j2d/TextCube.java index 3433463..4587e10 100755 --- a/src/demos/j2d/TextCube.java +++ b/src/demos/j2d/TextCube.java @@ -65,9 +65,6 @@ import com.jogamp.opengl.util.Animator; /** Shows how to place 2D text in 3D using the TextRenderer. */ public class TextCube extends Demo { - static { - GLProfile.initSingleton(); - } private float xAng; private float yAng; private GLU glu = new GLU(); @@ -77,6 +74,13 @@ public class TextCube extends Demo { private float textScaleFactor; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + Frame frame = new Frame("Text Cube"); frame.setLayout(new BorderLayout()); diff --git a/src/demos/j2d/TextFlow.java b/src/demos/j2d/TextFlow.java index 32c7600..f0f29f8 100755 --- a/src/demos/j2d/TextFlow.java +++ b/src/demos/j2d/TextFlow.java @@ -74,11 +74,13 @@ import com.jogamp.opengl.util.Animator; screen. */ public class TextFlow extends Demo { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); Frame frame = new Frame("Text Flow"); frame.setLayout(new BorderLayout()); diff --git a/src/demos/jrefract/JRefract.java b/src/demos/jrefract/JRefract.java index 1eed2e5..735355c 100755 --- a/src/demos/jrefract/JRefract.java +++ b/src/demos/jrefract/JRefract.java @@ -93,6 +93,13 @@ public class JRefract { private JDesktopPane desktop; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new JRefract().run(args); } diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java index daa6b45..701712c 100755 --- a/src/demos/misc/GLCapsTableDemo.java +++ b/src/demos/misc/GLCapsTableDemo.java @@ -51,9 +51,6 @@ public class GLCapsTableDemo implements GLCapabilitiesChooser { - static { - GLProfile.initSingleton(); - } private String[] colNames = {"Pfd", "H/W", "DblBfr", "Stereo", // index, hwaccel, double, stereo "CBits", "cR", "cG", "cB", "cA", // color bits @@ -172,6 +169,13 @@ public class GLCapsTableDemo */ public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + GLCapsTableDemo demo = new GLCapsTableDemo(); demo.run(args); } diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java index 5c55272..52afca0 100755 --- a/src/demos/misc/Picking.java +++ b/src/demos/misc/Picking.java @@ -22,11 +22,15 @@ import com.jogamp.opengl.util.Animator; public class Picking { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new Picking(); } diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java index 8e7facf..9c95b97 100755 --- a/src/demos/multisample/Multisample.java +++ b/src/demos/multisample/Multisample.java @@ -45,9 +45,6 @@ import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; public class Multisample { - static { - GLProfile.initSingleton(); - } private GLCanvas canvas; // Simple class to warn if results are not going to be as expected @@ -76,6 +73,13 @@ public class Multisample { } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new Multisample().run(args); } @@ -126,6 +130,7 @@ public class Multisample { class Listener implements GLEventListener { public void init(GLAutoDrawable drawable) { + System.err.println("Info: "+drawable); GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0, 0, 0, 0); diff --git a/src/demos/nurbs/curveapp/CurveApp.java b/src/demos/nurbs/curveapp/CurveApp.java index e125f62..ffefa42 100755 --- a/src/demos/nurbs/curveapp/CurveApp.java +++ b/src/demos/nurbs/curveapp/CurveApp.java @@ -41,10 +41,6 @@ import demos.nurbs.knotslidercomponent.JKnotSlider; @SuppressWarnings("serial") public class CurveApp extends JFrame implements ActionListener { - static { - GLProfile.initSingleton(); - } - /** * Name of X-coord editing component of actually selected control point * Jméno komponenty pro editaci X-ové souřadnice aktuálního bodu @@ -494,6 +490,13 @@ public class CurveApp extends JFrame implements ActionListener * */ public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new CurveApp(); } diff --git a/src/demos/nurbs/surfaceapp/SurfaceApp.java b/src/demos/nurbs/surfaceapp/SurfaceApp.java index c19e8c6..53631ce 100755 --- a/src/demos/nurbs/surfaceapp/SurfaceApp.java +++ b/src/demos/nurbs/surfaceapp/SurfaceApp.java @@ -45,10 +45,6 @@ import javax.media.opengl.awt.GLCanvas; @SuppressWarnings("serial") public class SurfaceApp extends JFrame implements ActionListener { - static { - GLProfile.initSingleton(); - } - /** * X-coord editing component name * Jméno komponenty pro editaci X-ové souřadnice aktuálního bodu @@ -736,6 +732,13 @@ public class SurfaceApp extends JFrame implements ActionListener * */ public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new SurfaceApp(); } diff --git a/src/demos/particles/engine/ControlWindow.java b/src/demos/particles/engine/ControlWindow.java index 8268e6f..ab94ff1 100755 --- a/src/demos/particles/engine/ControlWindow.java +++ b/src/demos/particles/engine/ControlWindow.java @@ -42,6 +42,8 @@ import javax.swing.border.*; import java.awt.event.*; import javax.swing.event.*; +import javax.media.opengl.GLProfile; + public class ControlWindow extends JFrame implements ActionListener, ChangeListener { // For the engine @@ -194,6 +196,13 @@ public class ControlWindow extends JFrame implements ActionListener, ChangeListe } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new ControlWindow(); } diff --git a/src/demos/printext/PrintExt.java b/src/demos/printext/PrintExt.java index 5ab5b42..4510f47 100755 --- a/src/demos/printext/PrintExt.java +++ b/src/demos/printext/PrintExt.java @@ -15,10 +15,14 @@ import javax.media.opengl.awt.GLCanvas; public class PrintExt { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + Frame frame = new Frame(); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new Listener()); diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java index e939718..bbde5ab 100644 --- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java +++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java @@ -75,11 +75,14 @@ import javax.swing.JOptionPane; * */ public class ProceduralTexturePhysics extends Demo { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + GLCanvas canvas = new GLCanvas(); final ProceduralTexturePhysics demo = new ProceduralTexturePhysics(); canvas.addGLEventListener(demo); diff --git a/src/demos/swt/Snippet209.java b/src/demos/swt/Snippet209.java index 1deb1c4..30a1347 100644 --- a/src/demos/swt/Snippet209.java +++ b/src/demos/swt/Snippet209.java @@ -34,9 +34,6 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.glu.GLU; public class Snippet209 { - static { - GLProfile.initSingleton(); - } static void drawTorus(GL2 gl, float r, float R, int nsides, int rings) { float ringDelta = 2.0f * (float) Math.PI / rings; float sideDelta = 2.0f * (float) Math.PI / nsides; @@ -65,6 +62,13 @@ public class Snippet209 { } public static void main(String [] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + final GLProfile gl2Profile = GLProfile.get(GLProfile.GL2); final Display display = new Display(); Shell shell = new Shell(display); diff --git a/src/demos/tess/Tess.java b/src/demos/tess/Tess.java index 8688570..d1484c4 100644 --- a/src/demos/tess/Tess.java +++ b/src/demos/tess/Tess.java @@ -74,10 +74,14 @@ import javax.media.opengl.glu.GLUtessellator; public class Tess { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + try { Frame frame = new Frame("Tess Demo"); frame.setSize(500, 500); diff --git a/src/demos/testContextDestruction/TestContextDestruction.java b/src/demos/testContextDestruction/TestContextDestruction.java index b2f2571..7a89082 100755 --- a/src/demos/testContextDestruction/TestContextDestruction.java +++ b/src/demos/testContextDestruction/TestContextDestruction.java @@ -68,9 +68,6 @@ import javax.swing.JFrame; as a GLCanvas is added to and removed from its parent container. */ public class TestContextDestruction { - static { - GLProfile.initSingleton(); - } private int gearDisplayList; private Frame frame1, frame2; private Component frame1ContainedComponent; @@ -84,6 +81,13 @@ public class TestContextDestruction { private static final int BORDER_WIDTH = 6; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new TestContextDestruction().run(args); } diff --git a/src/demos/testContextSharing/TestContextSharing.java b/src/demos/testContextSharing/TestContextSharing.java index 9e6dcce..f34e91f 100644 --- a/src/demos/testContextSharing/TestContextSharing.java +++ b/src/demos/testContextSharing/TestContextSharing.java @@ -55,13 +55,17 @@ import javax.media.opengl.awt.GLCanvas; /** A simple demonstration of sharing of display lists between drawables. */ public class TestContextSharing { - static { - GLProfile.initSingleton(); - } private int gearDisplayList; private Frame delayedFrame; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new TestContextSharing().run(args); } diff --git a/src/demos/texture/TestSubImage.java b/src/demos/texture/TestSubImage.java index 8f04e4a..377a910 100755 --- a/src/demos/texture/TestSubImage.java +++ b/src/demos/texture/TestSubImage.java @@ -85,9 +85,6 @@ import javax.swing.KeyStroke; Texture.updateSubImage(). */ public class TestSubImage { - static { - GLProfile.initSingleton(); - } private boolean haveForcedImageType; private int forcedImageType; private List imageTypeMenuItems = new ArrayList(); @@ -328,6 +325,13 @@ public class TestSubImage { } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new TestSubImage().run(); } } diff --git a/src/demos/texture/TestTexture.java b/src/demos/texture/TestTexture.java index 7524cd6..057e957 100755 --- a/src/demos/texture/TestTexture.java +++ b/src/demos/texture/TestTexture.java @@ -73,10 +73,14 @@ import javax.swing.KeyStroke; /** Demonstrates simple use of the TextureIO texture loader. */ public class TestTexture implements GLEventListener { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new TestTexture().run(args); } diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java index b41de6e..aed110d 100644 --- a/src/demos/vertexArrayRange/VertexArrayRange.java +++ b/src/demos/vertexArrayRange/VertexArrayRange.java @@ -52,7 +52,7 @@ import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; -import javax.media.opengl.util.Animator; +import com.jogamp.opengl.util.Animator; import javax.swing.JOptionPane; @@ -89,10 +89,14 @@ import javax.swing.JOptionPane; respectively. </P> */ public class VertexArrayRange extends Demo { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <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 startSlow = false; if (args.length > 1) { @@ -114,6 +118,14 @@ public class VertexArrayRange extends Demo { } canvas.addGLEventListener(demo); + final VertexArrayRange f_demo = demo; + canvas.addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + f_demo.dispatchKey(e.getKeyChar()); + } + }); + + final Animator animator = new Animator(canvas); animator.setRunAsFastAsPossible(true); demo.setDemoListener(new DemoListener() { @@ -350,15 +362,9 @@ public class VertexArrayRange extends Demo { gl.glEnableClientState(GL2ES1.GL_NORMAL_ARRAY); computeElements(); - - drawable.addKeyListener(new KeyAdapter() { - public void keyTyped(KeyEvent e) { - dispatchKey(e.getKeyChar()); - } - }); } - private void allocateBuffersAndFences(GL gl) { + private void allocateBuffersAndFences(GL2 gl) { buffers = new VarBuffer[numBuffers]; int[] fences = new int[1]; for (int i = 0; i < numBuffers; i++) { @@ -493,11 +499,11 @@ public class VertexArrayRange extends Demo { if (toggleVAR) { if (getFlag('v')) { - gl.glEnableClientState(GL2ES1.GL_VERTEX_ARRAY_RANGE_NV); + gl.glEnableClientState(GL2.GL_VERTEX_ARRAY_RANGE_NV); gl.glVertexArrayRangeNV(bufferSize, bigArrayVar); bigArray = bigArrayVar; } else { - gl.glDisableClientState(GL2ES1.GL_VERTEX_ARRAY_RANGE_NV); + gl.glDisableClientState(GL2.GL_VERTEX_ARRAY_RANGE_NV); bigArray = bigArraySystem; } toggleVAR = false; @@ -621,13 +627,13 @@ public class VertexArrayRange extends Demo { for (int i = 0; i < elements.length; i++) { ++numDrawElementsCalls; - gl.glDrawElements(primitive, elements[i].capacity(), GL.GL_UNSIGNED_INT, elements[i]); + gl.glDrawElements(primitive, elements[i].capacity(), GL2.GL_UNSIGNED_INT, elements[i]); if(getFlag('f')) { gl.glFlush(); } } - gl.glSetFenceNV(buffers[cur].fence, GL.GL_ALL_COMPLETED_NV); + gl.glSetFenceNV(buffers[cur].fence, GL2.GL_ALL_COMPLETED_NV); } gl.glPopMatrix(); @@ -661,7 +667,7 @@ public class VertexArrayRange extends Demo { // Unused routines public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - private void allocateBigArray(GL gl, boolean tryAgain) { + private void allocateBigArray(GL2 gl, boolean tryAgain) { float priority = .5f; bigArraySystem = setupBuffer(ByteBuffer.allocateDirect(bufferSize)); diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java index 28c9e0e..e71a785 100644 --- a/src/demos/vertexBufferObject/VertexBufferObject.java +++ b/src/demos/vertexBufferObject/VertexBufferObject.java @@ -86,11 +86,13 @@ import javax.swing.JOptionPane; */ public class VertexBufferObject extends Demo { - static { - GLProfile.initSingleton(); - } - public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <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 vboEnabled = true; diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java index 99cf05e..cac8d5a 100644 --- a/src/demos/vertexProgRefract/VertexProgRefract.java +++ b/src/demos/vertexProgRefract/VertexProgRefract.java @@ -75,10 +75,13 @@ import javax.swing.JOptionPane; */ public class VertexProgRefract extends Demo { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); GLCanvas canvas = new GLCanvas(); final VertexProgRefract demo = new VertexProgRefract(); diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java index 181d9ff..a9adb4e 100644 --- a/src/demos/vertexProgWarp/VertexProgWarp.java +++ b/src/demos/vertexProgWarp/VertexProgWarp.java @@ -76,9 +76,6 @@ import javax.swing.JOptionPane; */ public class VertexProgWarp extends Demo { - static { - GLProfile.initSingleton(); - } private Frame frame; private Animator animator; private volatile boolean quit; @@ -89,6 +86,13 @@ public class VertexProgWarp extends Demo { private int frameCount; public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new VertexProgWarp().run(args); } @@ -182,7 +186,7 @@ public class VertexProgWarp extends Demo { gl.glDisable(GL.GL_CULL_FACE); try { - initExtension(gl, "GL_vertex_program"); + initExtension(gl, "GL_ARB_vertex_program"); } catch (RuntimeException e) { shutdownDemo(); throw(e); diff --git a/src/demos/xtrans/Main.java b/src/demos/xtrans/Main.java index 783e7eb..3166121 100755 --- a/src/demos/xtrans/Main.java +++ b/src/demos/xtrans/Main.java @@ -47,6 +47,8 @@ import javax.swing.event.*; import javax.swing.table.*; import javax.swing.tree.*; +import javax.media.opengl.GLProfile; + /** Demonstration showing off XTDesktopPane. * * @author Kenneth Russell @@ -266,6 +268,13 @@ public class Main { } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new Main().run(args); } } |