From 1ff81eb806d6df78994a808217eb2c5f6b4ef8da Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 14 Oct 2010 21:34:27 +0200 Subject: Fix/Syn with JOGL 774138544e1eec3330309ad682fa05154a07ab8d ; Notably add: Applet's with native NEWT support, ie jogl-newt-applet-runner-gears.html --- java-dbg-swing.sh | 5 +- java-dbg.sh | 4 +- java-run-swing.sh | 4 +- jnlp-files/CustomText.jnlp | 4 +- jnlp-files/FlyingText.jnlp | 4 +- jnlp-files/Gears.jnlp | 4 +- jnlp-files/HWShadowmapsSimple.jnlp | 4 +- jnlp-files/InfiniteShadowVolumes.jnlp | 4 +- jnlp-files/JRefract.jnlp | 4 +- jnlp-files/JRefractNoOGL.jnlp | 4 +- jnlp-files/ParticleEngine.jnlp | 4 +- jnlp-files/ProceduralTexturePhysics.jnlp | 4 +- jnlp-files/TestTextRenderer.jnlp | 4 +- jnlp-files/TextCube.jnlp | 4 +- jnlp-files/TextCubeDebug.jnlp | 30 ++++ jnlp-files/TextFlow.jnlp | 4 +- jnlp-files/VertexArrayRange.jnlp | 4 +- jnlp-files/VertexBufferObject.jnlp | 4 +- jnlp-files/VertexProgRefract.jnlp | 4 +- jnlp-files/VertexProgWarp.jnlp | 4 +- jnlp-files/WorldWindBasicDemo.jnlp | 4 +- jnlp-files/XTrans.jnlp | 4 +- .../jogl-newt-applet-runner-angelesgl2es1.html | 7 + jnlp-files/jogl-newt-applet-runner-cube.html | 8 ++ jnlp-files/jogl-newt-applet-runner-fbcubes.html | 8 ++ jnlp-files/jogl-newt-applet-runner-gears.html | 8 ++ jnlp-files/version.jnlp | 4 +- jnlp-files/worldwind.jnlp | 4 +- make/build.xml | 3 +- nbproject/project.xml | 23 +++ src/demos/applets/GearsApplet.java | 4 +- src/demos/applets/GearsJOALApplet.java | 4 +- src/demos/applets/JOGLNewtApplet1Run.java | 1 + src/demos/applets/JOGLNewtAppletBase.java | 31 ++-- src/demos/cg/runtime_ogl/cgGL_vertex_example.java | 11 +- .../runtime_ogl_vertex_fragment.java | 11 +- src/demos/cubefbo/FBCubes.java | 4 - src/demos/cubefbo/Main.java | 10 +- src/demos/fullscreen/GearsFullscreen.java | 11 +- src/demos/fullscreen/GearsFullscreen2.java | 11 +- src/demos/gamma/TestGamma.java | 6 +- src/demos/gears/Gears.java | 156 +++++++++++---------- src/demos/hdr/HDR.java | 10 +- .../hwShadowmapsSimple/HWShadowmapsSimple.java | 21 ++- .../InfiniteShadowVolumes.java | 10 +- src/demos/j2d/CustomText.java | 10 +- src/demos/j2d/FlyingText.java | 11 +- src/demos/j2d/TestOverlay.java | 10 +- src/demos/j2d/TestTextRenderer.java | 11 +- src/demos/j2d/TestTextureRenderer.java | 10 +- src/demos/j2d/TextCube.java | 10 +- src/demos/j2d/TextFlow.java | 10 +- src/demos/jrefract/JRefract.java | 7 + src/demos/misc/GLCapsTableDemo.java | 10 +- src/demos/misc/Picking.java | 10 +- src/demos/multisample/Multisample.java | 11 +- src/demos/nurbs/curveapp/CurveApp.java | 11 +- src/demos/nurbs/surfaceapp/SurfaceApp.java | 11 +- src/demos/particles/engine/ControlWindow.java | 9 ++ src/demos/printext/PrintExt.java | 10 +- .../ProceduralTexturePhysics.java | 11 +- src/demos/swt/Snippet209.java | 10 +- src/demos/tess/Tess.java | 10 +- .../TestContextDestruction.java | 10 +- .../testContextSharing/TestContextSharing.java | 10 +- src/demos/texture/TestSubImage.java | 10 +- src/demos/texture/TestTexture.java | 10 +- src/demos/vertexArrayRange/VertexArrayRange.java | 38 ++--- .../vertexBufferObject/VertexBufferObject.java | 10 +- src/demos/vertexProgRefract/VertexProgRefract.java | 9 +- src/demos/vertexProgWarp/VertexProgWarp.java | 12 +- src/demos/xtrans/Main.java | 9 ++ src/gleem/TestExaminerViewer.java | 5 +- src/gleem/TestHandleBox.java | 5 +- src/gleem/TestMultiWin.java | 4 +- src/gleem/TestTranslate1.java | 4 +- src/gleem/TestTranslate2.java | 4 +- src/redbook/src/glredbook10/alpha.java | 11 +- src/redbook/src/glredbook1314/combiner.java | 11 +- src/redbook/src/glredbook1314/fogcoord.java | 11 +- src/redbook/src/glredbook1314/multisamp.java | 11 +- src/redbook/src/glredbook1314/shadowmap.java | 11 +- 82 files changed, 573 insertions(+), 285 deletions(-) create mode 100644 jnlp-files/TextCubeDebug.jnlp diff --git a/java-dbg-swing.sh b/java-dbg-swing.sh index afebefa..7c120d5 100644 --- a/java-dbg-swing.sh +++ b/java-dbg-swing.sh @@ -4,8 +4,9 @@ CPOK=0 echo $CLASSPATH | grep jogl && CPOK=1 #SWING_PROPS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=true" -#SWING_PROPS_DBG="-Djnlp.jogl.debug.GLJPanel=true" -SWING_PROPS_DBG="-Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all" +SWING_PROPS="-Dsun.java2d.noddraw=true" +SWING_PROPS_DBG="-Djnlp.jogl.debug.GLJPanel=true" +# SWING_PROPS_DBG="-Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all" if [ $CPOK -eq 0 ] ; then # Only valid for autobuild .. otherwise run manually with build-dir diff --git a/java-dbg.sh b/java-dbg.sh index 8fdab6c..04e4841 100644 --- a/java-dbg.sh +++ b/java-dbg.sh @@ -11,8 +11,8 @@ fi if [ $CPOK -eq 0 ] ; then echo No JOGL in CLASSPATH else -D_ARGS="-Djogamp.debug.JNILibLoader=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true -Djogl.debug.GLProfile=true" -# D_ARGS="-Djogl.debug=all -Dnewt.debug=all -Dnativewindow.debug=all" +# D_ARGS="-Djogamp.debug.JNILibLoader=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true -Djogl.debug.GLProfile=true" +D_ARGS="-Djogl.debug=all -Dnewt.debug=all -Dnativewindow.debug=all" java $D_ARGS $* 2>&1 | tee java-dbg.log fi diff --git a/java-run-swing.sh b/java-run-swing.sh index 795922b..13995bd 100644 --- a/java-run-swing.sh +++ b/java-run-swing.sh @@ -3,8 +3,8 @@ CPOK=0 echo $CLASSPATH | grep jogl && CPOK=1 -#SWING_PROPS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=true" -#SWING_PROPS_DBG="-Djnlp.jogl.debug.GLJPanel=true" +SWING_PROPS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false" +SWING_PROPS_DBG="-Djnlp.jogl.debug.GLJPanel=true" if [ $CPOK -eq 0 ] ; then # Only valid for autobuild .. otherwise run manually with build-dir diff --git a/jnlp-files/CustomText.jnlp b/jnlp-files/CustomText.jnlp index b81fb94..eb47a7f 100644 --- a/jnlp-files/CustomText.jnlp +++ b/jnlp-files/CustomText.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/FlyingText.jnlp b/jnlp-files/FlyingText.jnlp index 148d194..74a0810 100644 --- a/jnlp-files/FlyingText.jnlp +++ b/jnlp-files/FlyingText.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/Gears.jnlp b/jnlp-files/Gears.jnlp index 994529c..22aefde 100755 --- a/jnlp-files/Gears.jnlp +++ b/jnlp-files/Gears.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/HWShadowmapsSimple.jnlp b/jnlp-files/HWShadowmapsSimple.jnlp index 294f3aa..dfa7c7c 100644 --- a/jnlp-files/HWShadowmapsSimple.jnlp +++ b/jnlp-files/HWShadowmapsSimple.jnlp @@ -20,5 +20,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/InfiniteShadowVolumes.jnlp b/jnlp-files/InfiniteShadowVolumes.jnlp index 772d26d..ce833d4 100644 --- a/jnlp-files/InfiniteShadowVolumes.jnlp +++ b/jnlp-files/InfiniteShadowVolumes.jnlp @@ -20,5 +20,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/JRefract.jnlp b/jnlp-files/JRefract.jnlp index 8a5af91..f8003a8 100644 --- a/jnlp-files/JRefract.jnlp +++ b/jnlp-files/JRefract.jnlp @@ -24,5 +24,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/JRefractNoOGL.jnlp b/jnlp-files/JRefractNoOGL.jnlp index 7bce38a..1f6feba 100644 --- a/jnlp-files/JRefractNoOGL.jnlp +++ b/jnlp-files/JRefractNoOGL.jnlp @@ -20,5 +20,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/ParticleEngine.jnlp b/jnlp-files/ParticleEngine.jnlp index b13b2eb..86f88bd 100644 --- a/jnlp-files/ParticleEngine.jnlp +++ b/jnlp-files/ParticleEngine.jnlp @@ -18,5 +18,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/ProceduralTexturePhysics.jnlp b/jnlp-files/ProceduralTexturePhysics.jnlp index 6076629..aa321f4 100644 --- a/jnlp-files/ProceduralTexturePhysics.jnlp +++ b/jnlp-files/ProceduralTexturePhysics.jnlp @@ -20,5 +20,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/TestTextRenderer.jnlp b/jnlp-files/TestTextRenderer.jnlp index a46a277..1455e00 100644 --- a/jnlp-files/TestTextRenderer.jnlp +++ b/jnlp-files/TestTextRenderer.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/TextCube.jnlp b/jnlp-files/TextCube.jnlp index 25f1336..ab9ee6a 100644 --- a/jnlp-files/TextCube.jnlp +++ b/jnlp-files/TextCube.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/TextCubeDebug.jnlp b/jnlp-files/TextCubeDebug.jnlp new file mode 100644 index 0000000..a50ad1a --- /dev/null +++ b/jnlp-files/TextCubeDebug.jnlp @@ -0,0 +1,30 @@ + + + + Text Cube Debug + JogAmp Community + + Text Cube Debug + Shows how to use the TextRenderer to draw 2D text in 3D. Debug Version + + + + + + + + + + + + + + + + + + + NotFirstUIActionOnProcess + + diff --git a/jnlp-files/TextFlow.jnlp b/jnlp-files/TextFlow.jnlp index 7b79aac..bff834d 100644 --- a/jnlp-files/TextFlow.jnlp +++ b/jnlp-files/TextFlow.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/VertexArrayRange.jnlp b/jnlp-files/VertexArrayRange.jnlp index edc5b53..eae869e 100644 --- a/jnlp-files/VertexArrayRange.jnlp +++ b/jnlp-files/VertexArrayRange.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/VertexBufferObject.jnlp b/jnlp-files/VertexBufferObject.jnlp index 035e0af..cfa6f9c 100644 --- a/jnlp-files/VertexBufferObject.jnlp +++ b/jnlp-files/VertexBufferObject.jnlp @@ -19,5 +19,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/VertexProgRefract.jnlp b/jnlp-files/VertexProgRefract.jnlp index 1b0830b..3d50e30 100644 --- a/jnlp-files/VertexProgRefract.jnlp +++ b/jnlp-files/VertexProgRefract.jnlp @@ -20,5 +20,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/VertexProgWarp.jnlp b/jnlp-files/VertexProgWarp.jnlp index 3d9c8d0..733c0a9 100644 --- a/jnlp-files/VertexProgWarp.jnlp +++ b/jnlp-files/VertexProgWarp.jnlp @@ -20,5 +20,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/WorldWindBasicDemo.jnlp b/jnlp-files/WorldWindBasicDemo.jnlp index 358c614..0ddc6cf 100644 --- a/jnlp-files/WorldWindBasicDemo.jnlp +++ b/jnlp-files/WorldWindBasicDemo.jnlp @@ -23,5 +23,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/XTrans.jnlp b/jnlp-files/XTrans.jnlp index 076808d..ae351e8 100644 --- a/jnlp-files/XTrans.jnlp +++ b/jnlp-files/XTrans.jnlp @@ -23,5 +23,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html b/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html index 141bac6..d404db0 100644 --- a/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html +++ b/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html @@ -19,6 +19,13 @@

+JOGL NEWT JNLP Applet Runner Special Keys:
+

    +
  • d - toggle decoration
  • +
  • f - toggle fullscreen
  • +
  • r - in/out browser window
  • +
+

diff --git a/jnlp-files/jogl-newt-applet-runner-cube.html b/jnlp-files/jogl-newt-applet-runner-cube.html index 42310ae..bed8526 100644 --- a/jnlp-files/jogl-newt-applet-runner-cube.html +++ b/jnlp-files/jogl-newt-applet-runner-cube.html @@ -19,6 +19,14 @@

+JOGL NEWT JNLP Applet Runner Special Keys:
+

    +
  • d - toggle decoration
  • +
  • f - toggle fullscreen
  • +
  • r - in/out browser window
  • +
+

+ diff --git a/jnlp-files/jogl-newt-applet-runner-fbcubes.html b/jnlp-files/jogl-newt-applet-runner-fbcubes.html index ccc9b80..bae59a4 100644 --- a/jnlp-files/jogl-newt-applet-runner-fbcubes.html +++ b/jnlp-files/jogl-newt-applet-runner-fbcubes.html @@ -19,6 +19,14 @@

+JOGL NEWT JNLP Applet Runner Special Keys:
+

    +
  • d - toggle decoration
  • +
  • f - toggle fullscreen
  • +
  • r - in/out browser window
  • +
+

+ diff --git a/jnlp-files/jogl-newt-applet-runner-gears.html b/jnlp-files/jogl-newt-applet-runner-gears.html index 8214420..6da92ea 100644 --- a/jnlp-files/jogl-newt-applet-runner-gears.html +++ b/jnlp-files/jogl-newt-applet-runner-gears.html @@ -19,6 +19,14 @@

+JOGL NEWT JNLP Applet Runner Special Keys:
+

    +
  • d - toggle decoration
  • +
  • f - toggle fullscreen
  • +
  • r - in/out browser window
  • +
+

+ diff --git a/jnlp-files/version.jnlp b/jnlp-files/version.jnlp index 8d07c08..1db0e07 100644 --- a/jnlp-files/version.jnlp +++ b/jnlp-files/version.jnlp @@ -17,5 +17,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/jnlp-files/worldwind.jnlp b/jnlp-files/worldwind.jnlp index 9f26054..f06c78a 100644 --- a/jnlp-files/worldwind.jnlp +++ b/jnlp-files/worldwind.jnlp @@ -23,5 +23,7 @@ - + + NotFirstUIActionOnProcess + diff --git a/make/build.xml b/make/build.xml index 4f2f7b1..57973b5 100644 --- a/make/build.xml +++ b/make/build.xml @@ -170,8 +170,7 @@ - - diff --git a/nbproject/project.xml b/nbproject/project.xml index e688bdf..f0d7983 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,16 +3,31 @@ org.netbeans.modules.ant.freeform + jogl-demos + + jogl-demos make/build.xml + + + . + UTF-8 + + + + java + src/redbook/src + UTF-8 + java src + UTF-8 @@ -68,6 +83,10 @@ + + + src/redbook/src + src @@ -92,6 +111,10 @@ build 1.5 + + src/redbook/src + 1.5 + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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
@@ -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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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.

*/ 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + 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 + // + // NotFirstUIActionOnProcess + // + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + new Main().run(args); } } diff --git a/src/gleem/TestExaminerViewer.java b/src/gleem/TestExaminerViewer.java index e7d0838..712feec 100644 --- a/src/gleem/TestExaminerViewer.java +++ b/src/gleem/TestExaminerViewer.java @@ -59,10 +59,6 @@ import javax.media.opengl.glu.GLU; /** Tests the Examiner Viewer. */ public class TestExaminerViewer { - static { - GLProfile.initSingleton(); - } - private static final int X_SIZE = 400; private static final int Y_SIZE = 400; @@ -154,6 +150,7 @@ public class TestExaminerViewer { } public static void main(String[] args) { + GLProfile.initSingleton(true); Frame frame = new Frame("ExaminerViewer Test"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { diff --git a/src/gleem/TestHandleBox.java b/src/gleem/TestHandleBox.java index 76583f3..6e27441 100644 --- a/src/gleem/TestHandleBox.java +++ b/src/gleem/TestHandleBox.java @@ -58,10 +58,6 @@ import javax.media.opengl.glu.GLU; /** Tests the HandleBox Manip. */ public class TestHandleBox { - static { - GLProfile.initSingleton(); - } - private static final int X_SIZE = 400; private static final int Y_SIZE = 400; @@ -142,6 +138,7 @@ public class TestHandleBox { } public static void main(String[] args) { + GLProfile.initSingleton(true); Frame frame = new Frame("HandleBox Test"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { diff --git a/src/gleem/TestMultiWin.java b/src/gleem/TestMultiWin.java index 0c81b71..521f7db 100644 --- a/src/gleem/TestMultiWin.java +++ b/src/gleem/TestMultiWin.java @@ -60,9 +60,6 @@ import javax.media.opengl.glu.GLU; /** Tests viewing manipulators in multiple winodws. */ public class TestMultiWin { - static { - GLProfile.initSingleton(); - } private static final int X_SIZE = 400; private static final int Y_SIZE = 400; @@ -170,6 +167,7 @@ public class TestMultiWin { } public static void main(String[] args) { + GLProfile.initSingleton(true); // Instantiate HandleBoxManip manip = new HandleBoxManip(); manip.setTranslation(new Vec3f(0, 0, -10)); diff --git a/src/gleem/TestTranslate1.java b/src/gleem/TestTranslate1.java index b61747c..4945305 100644 --- a/src/gleem/TestTranslate1.java +++ b/src/gleem/TestTranslate1.java @@ -59,9 +59,6 @@ import javax.media.opengl.glu.GLU; /** Tests the Translate1 Manip. */ public class TestTranslate1 { - static { - GLProfile.initSingleton(); - } private static final int X_SIZE = 400; private static final int Y_SIZE = 400; @@ -143,6 +140,7 @@ public class TestTranslate1 { } public static void main(String[] args) { + GLProfile.initSingleton(true); Frame frame = new Frame("Translate1 Test"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { diff --git a/src/gleem/TestTranslate2.java b/src/gleem/TestTranslate2.java index 2795817..5ec40a3 100644 --- a/src/gleem/TestTranslate2.java +++ b/src/gleem/TestTranslate2.java @@ -59,9 +59,6 @@ import javax.media.opengl.glu.GLU; /** Tests the Translate2 Manip. */ public class TestTranslate2 { - static { - GLProfile.initSingleton(); - } private static final int X_SIZE = 400; private static final int Y_SIZE = 400; @@ -143,6 +140,7 @@ public class TestTranslate2 { } public static void main(String[] args) { + GLProfile.initSingleton(true); Frame frame = new Frame("Translate2 Test"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { diff --git a/src/redbook/src/glredbook10/alpha.java b/src/redbook/src/glredbook10/alpha.java index 0c1a653..c040a41 100644 --- a/src/redbook/src/glredbook10/alpha.java +++ b/src/redbook/src/glredbook10/alpha.java @@ -19,9 +19,6 @@ import javax.media.opengl.glu.GLU; public class alpha// extends GLSkeleton implements GLEventListener, KeyListener { - static { - GLProfile.initSingleton(); - } @Override protected GLCanvas createDrawable() { @@ -38,6 +35,14 @@ public class alpha// * mode, and handle input events. */ public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // + // NotFirstUIActionOnProcess + // + // boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + // GLProfile.initSingleton(firstUIActionOnProcess); + GLProfile.initSingleton(false); // just lazy to touch all html/jnlp's + alpha demo = new alpha(); // JFrame.setDefaultLookAndFeelDecorated(true); diff --git a/src/redbook/src/glredbook1314/combiner.java b/src/redbook/src/glredbook1314/combiner.java index 6c50d3e..27cff3e 100644 --- a/src/redbook/src/glredbook1314/combiner.java +++ b/src/redbook/src/glredbook1314/combiner.java @@ -30,9 +30,6 @@ import javax.media.opengl.glu.GLU; public class combiner// extends GLSkeleton implements GLEventListener, KeyListener { - static { - GLProfile.initSingleton(); - } private GLU glu; private static final int imageWidth = 8; private static final int imageHeight = 8; @@ -59,6 +56,14 @@ public class combiner// } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // + // NotFirstUIActionOnProcess + // + // boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + // GLProfile.initSingleton(firstUIActionOnProcess); + GLProfile.initSingleton(false); // just lazy to touch all html/jnlp's + combiner demo = new combiner(); GLCapabilities caps = new GLCapabilities(null); diff --git a/src/redbook/src/glredbook1314/fogcoord.java b/src/redbook/src/glredbook1314/fogcoord.java index 4375d80..19410de 100644 --- a/src/redbook/src/glredbook1314/fogcoord.java +++ b/src/redbook/src/glredbook1314/fogcoord.java @@ -29,9 +29,6 @@ public class fogcoord// extends GLSkeleton implements GLEventListener, KeyListener { - static { - GLProfile.initSingleton(); - } private GLU glu; private float f1, f2, f3; private KeyEvent key; @@ -48,6 +45,14 @@ public class fogcoord// } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // + // NotFirstUIActionOnProcess + // + // boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + // GLProfile.initSingleton(firstUIActionOnProcess); + GLProfile.initSingleton(false); // just lazy to touch all html/jnlp's + GLCapabilities caps = new GLCapabilities(null); GLCanvas canvas = new GLCanvas(caps); diff --git a/src/redbook/src/glredbook1314/multisamp.java b/src/redbook/src/glredbook1314/multisamp.java index 4aa4c3f..f3212b7 100644 --- a/src/redbook/src/glredbook1314/multisamp.java +++ b/src/redbook/src/glredbook1314/multisamp.java @@ -23,9 +23,6 @@ import javax.media.opengl.glu.GLU; public class multisamp // extends GLSkeleton implements GLEventListener, KeyListener { - static { - GLProfile.initSingleton(); - } private GLU glu; private boolean bgtoggle = true; @@ -42,6 +39,14 @@ public class multisamp // } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // + // NotFirstUIActionOnProcess + // + // boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + // GLProfile.initSingleton(firstUIActionOnProcess); + GLProfile.initSingleton(false); // just lazy to touch all html/jnlp's + multisamp demo = new multisamp(); JFrame.setDefaultLookAndFeelDecorated(true); diff --git a/src/redbook/src/glredbook1314/shadowmap.java b/src/redbook/src/glredbook1314/shadowmap.java index 952145c..176d529 100644 --- a/src/redbook/src/glredbook1314/shadowmap.java +++ b/src/redbook/src/glredbook1314/shadowmap.java @@ -20,9 +20,6 @@ import javax.media.opengl.glu.GLU; public class shadowmap // extends GLSkeleton implements GLEventListener, KeyListener { - static { - GLProfile.initSingleton(); - } private GLU glu; private GLUT glut; private FPSAnimator animator; @@ -75,6 +72,14 @@ public class shadowmap // } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // + // NotFirstUIActionOnProcess + // + // boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + // GLProfile.initSingleton(firstUIActionOnProcess); + GLProfile.initSingleton(false); // just lazy to touch all html/jnlp's + new shadowmap().run(); } -- cgit v1.2.3