diff options
author | Sven Gothel <[email protected]> | 2009-10-10 07:22:31 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-10-10 07:22:31 -0700 |
commit | f21921ffbee502483b87b0f7eb03c0af299cb24b (patch) | |
tree | 265abd9c59e65b32bee5920b96c22bae3804cbe9 | |
parent | 983ed55be2d69de57e52a106ea8809b52730ad12 (diff) |
JOGL changes ..
-rwxr-xr-x | java-dbg-noawt.sh | 4 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html | 1 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-cube.html | 1 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-fbcubes.html | 1 | ||||
-rw-r--r-- | jnlp-files/jogl-newt-applet-runner-gears.html | 1 | ||||
-rwxr-xr-x | src/demos/GLNewtRun.java | 4 | ||||
-rwxr-xr-x | src/demos/applets/JOGLNewtApplet1Run.java | 6 | ||||
-rwxr-xr-x | src/demos/applets/JOGLNewtAppletBase.java | 15 | ||||
-rwxr-xr-x | src/demos/es1/RedSquare.java | 99 | ||||
-rwxr-xr-x | src/demos/es2/RedSquare.java | 62 |
10 files changed, 93 insertions, 101 deletions
diff --git a/java-dbg-noawt.sh b/java-dbg-noawt.sh index 15b4070..8c2f203 100755 --- a/java-dbg-noawt.sh +++ b/java-dbg-noawt.sh @@ -14,8 +14,8 @@ fi if [ $CPOK -eq 0 ] ; then echo No JOGL in CLASSPATH else - # D_ARGS="-Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" - D_ARGS="-Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogl.debug.GLSLState" + # D_ARGS="-Djogl.verbose=true -Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" + D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogl.debug.GLSLState" if [ $MOSX -eq 1 ] ; then X_ARGS="-XstartOnFirstThread" fi diff --git a/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html b/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html index 067b918..141bac6 100644 --- a/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html +++ b/jnlp-files/jogl-newt-applet-runner-angelesgl2es1.html @@ -12,7 +12,6 @@ <param name="gl_event_listener_class" value="demos.es1.angeles.AngelesGL"> <param name="gl_profile" value="GL2ES1"> <param name="gl_swap_interval" value="1"> - <param name="gl_use_in_events" value="false"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> diff --git a/jnlp-files/jogl-newt-applet-runner-cube.html b/jnlp-files/jogl-newt-applet-runner-cube.html index 09ffab0..42310ae 100644 --- a/jnlp-files/jogl-newt-applet-runner-cube.html +++ b/jnlp-files/jogl-newt-applet-runner-cube.html @@ -12,7 +12,6 @@ <param name="gl_event_listener_class" value="demos.es1.cube.Cube"> <param name="gl_profile" value="GL2ES1"> <param name="gl_swap_interval" value="1"> - <param name="gl_use_in_events" value="false"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> diff --git a/jnlp-files/jogl-newt-applet-runner-fbcubes.html b/jnlp-files/jogl-newt-applet-runner-fbcubes.html index 9a47614..ccc9b80 100644 --- a/jnlp-files/jogl-newt-applet-runner-fbcubes.html +++ b/jnlp-files/jogl-newt-applet-runner-fbcubes.html @@ -12,7 +12,6 @@ <param name="gl_event_listener_class" value="demos.es1.cubefbo.FBCubes"> <param name="gl_profile" value="GL2ES1"> <param name="gl_swap_interval" value="1"> - <param name="gl_use_in_events" value="false"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> diff --git a/jnlp-files/jogl-newt-applet-runner-gears.html b/jnlp-files/jogl-newt-applet-runner-gears.html index da05b53..8214420 100644 --- a/jnlp-files/jogl-newt-applet-runner-gears.html +++ b/jnlp-files/jogl-newt-applet-runner-gears.html @@ -12,7 +12,6 @@ <param name="gl_event_listener_class" value="demos.gears.Gears"> <param name="gl_profile" value="GL2"> <param name="gl_swap_interval" value="1"> - <param name="gl_use_in_events" value="false"> <param name="gl_debug" value="false"> <param name="gl_trace" value="false"> <param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"> diff --git a/src/demos/GLNewtRun.java b/src/demos/GLNewtRun.java index 0df07fc..fd663b3 100755 --- a/src/demos/GLNewtRun.java +++ b/src/demos/GLNewtRun.java @@ -197,6 +197,7 @@ public class GLNewtRun implements WindowListener, KeyListener, MouseListener { try { GLCapabilities caps = new GLCapabilities(glp); + NewtFactory.setUseEDT(true); Window nWindow = null; if(useAWT) { Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display @@ -233,9 +234,6 @@ public class GLNewtRun implements WindowListener, KeyListener, MouseListener { window.addMouseListener(listener); window.addKeyListener(listener); window.addGLEventListener(demo); - // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default - window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. - window.setRunPumpMessages(true); window.setPosition(x, y); window.setSize(width, height); diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java index 2d8cd3c..f839387 100755 --- a/src/demos/applets/JOGLNewtApplet1Run.java +++ b/src/demos/applets/JOGLNewtApplet1Run.java @@ -26,8 +26,6 @@ public class JOGLNewtApplet1Run extends Applet { String glEventListenerClazzName=null; String glProfileName=null; int glSwapInterval=0; - boolean handleWindowEvents=true; - boolean useGLInEventHandler=false; boolean glDebug=false; boolean glTrace=false; String tmp; @@ -35,7 +33,6 @@ public class JOGLNewtApplet1Run extends Applet { glEventListenerClazzName = getParameter("gl_event_listener_class"); glProfileName = getParameter("gl_profile"); glSwapInterval = JOGLNewtAppletBase.str2Int(getParameter("gl_swap_interval"), glSwapInterval); - useGLInEventHandler = JOGLNewtAppletBase.str2Bool(getParameter("gl_use_in_events"), useGLInEventHandler); glDebug = JOGLNewtAppletBase.str2Bool(getParameter("gl_debug"), glDebug); glTrace = JOGLNewtAppletBase.str2Bool(getParameter("gl_trace"), glTrace); } catch (Exception e) { @@ -46,8 +43,7 @@ public class JOGLNewtApplet1Run extends Applet { } base = new JOGLNewtAppletBase(glEventListenerClazzName, glSwapInterval, - handleWindowEvents, - useGLInEventHandler, + false /* pumpMessages == handleWindowEvents */, glDebug, glTrace); diff --git a/src/demos/applets/JOGLNewtAppletBase.java b/src/demos/applets/JOGLNewtAppletBase.java index 54dcf8f..12d2af7 100755 --- a/src/demos/applets/JOGLNewtAppletBase.java +++ b/src/demos/applets/JOGLNewtAppletBase.java @@ -16,7 +16,6 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis String glEventListenerClazzName; int glSwapInterval; boolean handleWindowEvents; - boolean useGLInEventHandler; boolean glDebug; boolean glTrace; @@ -28,14 +27,12 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public JOGLNewtAppletBase(String glEventListenerClazzName, int glSwapInterval, boolean handleWindowEvents, - boolean useGLInEventHandler, boolean glDebug, boolean glTrace) { this.glEventListenerClazzName=glEventListenerClazzName; this.glSwapInterval=glSwapInterval; this.handleWindowEvents=handleWindowEvents; - this.useGLInEventHandler=useGLInEventHandler; this.glDebug = glDebug; this.glTrace = glTrace; } @@ -98,6 +95,10 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } public void init(Window nWindow) { + init(Thread.currentThread().getThreadGroup(), nWindow); + } + + public void init(ThreadGroup tg, Window nWindow) { glEventListener = createInstance(glEventListenerClazzName); try { @@ -125,13 +126,11 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis } glWindow.addKeyListener(this); - glWindow.setEventHandlerMode( useGLInEventHandler ? GLWindow.EVENT_HANDLER_GL_CURRENT : GLWindow.EVENT_HANDLER_GL_NONE ); glWindow.setRunPumpMessages(handleWindowEvents); - glWindow.setVisible(true); glWindow.enablePerfLog(true); // glAnimator = new FPSAnimator(canvas, 60); - glAnimator = new Animator(glWindow); + glAnimator = new Animator(tg, glWindow); } catch (Throwable t) { throw new RuntimeException(t); } @@ -140,6 +139,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public void start() { if(isValid) { + glWindow.setVisible(true); glAnimator.start(); } } @@ -147,6 +147,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis public void stop() { if(null!=glAnimator) { glAnimator.stop(); + glWindow.setVisible(false); } } @@ -158,7 +159,7 @@ public class JOGLNewtAppletBase implements WindowListener, KeyListener, MouseLis glAnimator=null; } if(null!=glWindow) { - glWindow.destroy(); + glWindow.destroy(true); // deep, incl. Screen and Display glWindow=null; } } diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 53485b0..5018d5b 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -23,6 +23,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo private boolean quit = false; private String glprofile; private int type; + Animator glAnimator=null; public RedSquare() { this(null, USE_NEWT); @@ -41,28 +42,38 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo } public void windowDestroyNotify(WindowEvent e) { + System.out.println("WINDOW-DESTROY NOTIFY "+Thread.currentThread()+" QUIT "+e); quit=true; + if(null!=glAnimator) { + glAnimator.stop(); + } } public void windowGainedFocus(WindowEvent e) { } public void windowLostFocus(WindowEvent e) { } public void keyPressed(KeyEvent e) { - System.out.println(glp+" "+e); + System.out.println("KEY-PRESSED "+Thread.currentThread()+" UNHANDLED "+e); + } + public void keyReleased(KeyEvent e) { + System.out.println("KEY-RELEASED "+Thread.currentThread()+" UNHANDLED "+e); + } + public void keyTyped(KeyEvent e) { if(e.getKeyChar()=='f') { + System.out.println("KEY-TYPED "+Thread.currentThread()+" FULLSCREEN "+e); window.setFullscreen(!window.isFullscreen()); } else if(e.getKeyChar()=='q') { + System.out.println("KEY-TYPED "+Thread.currentThread()+" QUIT "+e); quit = true; + if(null!=glAnimator) { + glAnimator.stop(); + } + } else { + System.out.println("KEY-TYPED "+Thread.currentThread()+" UNHANDLED "+e); } } - public void keyReleased(KeyEvent e) { - System.out.println(glp+" "+e); - } - public void keyTyped(KeyEvent e) { - System.out.println(glp+" "+e); - } public void mouseClicked(MouseEvent e) { - System.out.println(glp+" mouseevent: "+e); + System.out.println("MOUSE-CLICKED "+Thread.currentThread()+" UNHANDLED "+e); switch(e.getClickCount()) { case 1: if(e.getButton()>MouseEvent.BUTTON1) { @@ -92,10 +103,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public boolean shouldQuit() { return quit; } public void run() { - System.err.println(glp+" RedSquare.run() 0"); int width = 800; int height = 480; glp = GLProfile.get(glprofile); + System.out.println("RUN "+Thread.currentThread()+" "+glp); try { GLCapabilities caps = new GLCapabilities(glp); @@ -113,9 +124,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo window.addMouseListener(this); window.addKeyListener(this); window.addGLEventListener(this); - // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default - window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. - window.setRunPumpMessages(pumpOnce?false:true); window.enablePerfLog(true); // Size OpenGL to Video Surface @@ -125,11 +133,20 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo window.enablePerfLog(true); if(!oneThread) { - do { - display(); - } while (!quit && window.getDuration() < 20000) ; - - shutdown(); + if(useAnimator) { + System.out.println("Using Animator .. "+Thread.currentThread()); + glAnimator = new Animator(Thread.currentThread().getThreadGroup(), window); + glAnimator.start(); + while (glAnimator.isAnimating()) { + Thread.yield(); + } + shutdown(); + } else { + do { + display(); + } while (!quit && window.getDuration() < 20000) ; + shutdown(); + } } } catch (Throwable t) { t.printStackTrace(); @@ -138,9 +155,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void display() { try { - if(pumpOnce && !oneThread) { - GLWindow.runCurrentThreadPumpMessage(); - } window.display(); } catch (Throwable t) { t.printStackTrace(); @@ -149,12 +163,14 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void shutdown() { try { + System.out.println("SHUTDOWN "+Thread.currentThread()+" START"); // Shut things down cooperatively - window.destroy(); + window.destroy(true); if(oneThread) { window.getFactory().shutdown(); } - System.out.println(glp+" RedSquare shut down cleanly."); + window = null; + System.out.println("SHUTDOWN "+Thread.currentThread()+" FIN"); } catch (Throwable t) { t.printStackTrace(); } @@ -209,14 +225,14 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo glu = GLU.createGLU(gl); - System.err.println(glp+" Entering initialization"); - System.err.println(glp+" GL Profile: "+gl.getGLProfile()); - System.err.println(glp+" GL:" + gl); - System.err.println(glp+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION)); - System.err.println(glp+" GL_EXTENSIONS:"); - System.err.println(glp+" " + gl.glGetString(gl.GL_EXTENSIONS)); - System.err.println(glp+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")"); - System.err.println(glp+" GLU: " + glu); + System.err.println(Thread.currentThread()+" Entering initialization"); + System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile()); + System.err.println(Thread.currentThread()+" GL:" + gl); + System.err.println(Thread.currentThread()+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION)); + System.err.println(Thread.currentThread()+" GL_EXTENSIONS:"); + System.err.println(Thread.currentThread()+" " + gl.glGetString(gl.GL_EXTENSIONS)); + System.err.println(Thread.currentThread()+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")"); + System.err.println(Thread.currentThread()+" GLU: " + glu); // Allocate vertex arrays colors = BufferUtil.newFloatBuffer(16); @@ -270,7 +286,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void dispose(GLAutoDrawable drawable) { GL2ES1 gl = drawable.getGL().getGL2ES1(); - System.out.println(glp+" RedSquare.dispose: "+gl.getContext()); + System.out.println(Thread.currentThread()+" RedSquare.dispose: "+gl.getContext()); gl.glDisableClientState(gl.GL_VERTEX_ARRAY); gl.glDisableClientState(gl.GL_COLOR_ARRAY); glu.destroy(); @@ -279,7 +295,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo colors = null; vertices.clear(); vertices = null; - System.out.println(glp+" RedSquare.dispose: fin"); + System.out.println(Thread.currentThread()+" RedSquare.dispose: FIN"); } public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { @@ -289,11 +305,12 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public static int USE_AWT = 1 << 0; public static boolean oneThread = false; - public static boolean pumpOnce = true; + public static boolean useAnimator = false; public static int swapInterval = -1; public static void main(String[] args) { int type = USE_NEWT ; + boolean useEDT = true; List threads = new ArrayList(); for(int i=0; i<args.length; i++) { if(args[i].equals("-swapi")) { @@ -307,12 +324,14 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo glDebug=true; } else if(args[i].equals("-debugff")) { glDebugEmu=true; - } else if(args[i].equals("-pumponce")) { - pumpOnce=true; } else if(args[i].equals("-1thread")) { oneThread=true; } else if(args[i].equals("-awt")) { type |= USE_AWT; + } else if(args[i].equals("-noedt")) { + useEDT = false; + } else if(args[i].equals("-animator")) { + useAnimator = true; } else if(args[i].startsWith("-GL")) { threads.add(new RedSquare(args[i].substring(1), type)); } @@ -321,16 +340,13 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo threads.add(new RedSquare(GLProfile.GL2ES1, type)); } - if(!oneThread) { - Thread firstT = (Thread) threads.remove(0); + NewtFactory.setUseEDT(useEDT); // true is the default + if(!oneThread) { for(Iterator i = threads.iterator(); i.hasNext(); ) { ((Thread)i.next()).start(); } - // always run the first on main .. - firstT.run(); - boolean done = false; while(!done) { @@ -351,9 +367,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo ((Thread)i.next()).run(); } while (threads.size()>0) { - if(pumpOnce) { - GLWindow.runCurrentThreadPumpMessage(); - } for(Iterator i = threads.iterator(); i.hasNext(); ) { RedSquare app = (RedSquare) i.next(); if(app.shouldQuit()) { diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index 2acb321..be7e7f5 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -38,26 +38,30 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void windowLostFocus(WindowEvent e) { } public void windowDestroyNotify(WindowEvent e) { + System.out.println("WINDOW-DESTROY NOTIFY "+Thread.currentThread()+" QUIT "+e); quit = true; } public void keyPressed(KeyEvent e) { - System.out.println(glp+" "+e); + System.out.println("KEY-PRESSED "+Thread.currentThread()+" UNHANDLED "+e); + } + public void keyReleased(KeyEvent e) { + System.out.println("KEY-RELEASED "+Thread.currentThread()+" UNHANDLED "+e); + } + public void keyTyped(KeyEvent e) { if(e.getKeyChar()=='f') { + System.out.println("KEY-TYPED "+Thread.currentThread()+" FULLSCREEN "+e); window.setFullscreen(!window.isFullscreen()); } else if(e.getKeyChar()=='q') { + System.out.println("KEY-TYPED "+Thread.currentThread()+" QUIT "+e); quit = true; + } else { + System.out.println("KEY-TYPED "+Thread.currentThread()+" UNHANDLED "+e); } } - public void keyReleased(KeyEvent e) { - System.out.println(glp+" "+e); - } - public void keyTyped(KeyEvent e) { - System.out.println(glp+" "+e); - } public void mouseClicked(MouseEvent e) { - System.out.println(glp+" mouseevent: "+e); + System.out.println("MOUSE-CLICKED "+Thread.currentThread()+" UNHANDLED "+e); switch(e.getClickCount()) { case 1: if(e.getButton()>MouseEvent.BUTTON1) { @@ -87,10 +91,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public boolean shouldQuit() { return quit; } public void run() { - System.err.println(glp+" RedSquare.run()"); int width = 800; int height = 480; glp = GLProfile.get(glprofile); + System.out.println("RUN "+Thread.currentThread()+" "+glp); try { GLCapabilities caps = new GLCapabilities(glp); @@ -108,9 +112,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo window.addMouseListener(this); window.addKeyListener(this); window.addGLEventListener(this); - // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default - window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. - window.setRunPumpMessages(pumpOnce?false:true); // Size OpenGL to Video Surface window.setSize(width, height); @@ -133,9 +134,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void display() { try { - if(pumpOnce && !oneThread) { - GLWindow.runCurrentThreadPumpMessage(); - } window.display(); } catch (Throwable t) { t.printStackTrace(); @@ -149,7 +147,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo if(oneThread) { window.getFactory().shutdown(); } - System.out.println(glp+" RedSquare shut down cleanly."); + System.out.println("SHUTDOWN "+Thread.currentThread()+" cleanly"); } catch (Throwable t) { t.printStackTrace(); } @@ -187,13 +185,13 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo gl.setSwapInterval(swapInterval); } - System.err.println(glp+" Entering initialization"); - System.err.println(glp+" GL Profile: "+gl.getGLProfile()); - System.err.println(glp+" GL:" + gl); - System.err.println(glp+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION)); - System.err.println(glp+" GL_EXTENSIONS:"); - System.err.println(glp+" " + gl.glGetString(gl.GL_EXTENSIONS)); - System.err.println(glp+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")"); + System.err.println(Thread.currentThread()+" Entering initialization"); + System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile()); + System.err.println(Thread.currentThread()+" GL:" + gl); + System.err.println(Thread.currentThread()+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION)); + System.err.println(Thread.currentThread()+" GL_EXTENSIONS:"); + System.err.println(Thread.currentThread()+" " + gl.glGetString(gl.GL_EXTENSIONS)); + System.err.println(Thread.currentThread()+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")"); if(debuggl) { try { @@ -250,7 +248,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo st.glUseProgram(gl, false); // Let's show the completed shader state .. - System.out.println(glp+" "+st); + System.out.println(Thread.currentThread()+" "+st); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { @@ -275,13 +273,13 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void dispose(GLAutoDrawable drawable) { GL2ES2 gl = drawable.getGL().getGL2ES2(); - System.out.println(glp+" RedSquare.dispose: "+gl.getContext()); + System.out.println(Thread.currentThread()+" RedSquare.dispose: "+gl.getContext()); st.destroy(gl); st=null; pmvMatrix.destroy(); pmvMatrix=null; - System.out.println(glp+" RedSquare.dispose: fin"); + System.out.println(Thread.currentThread()+" RedSquare.dispose: FIN"); } public void display(GLAutoDrawable drawable) { @@ -318,11 +316,11 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public static int USE_AWT = 1 << 0; public static boolean oneThread = false; - public static boolean pumpOnce = true; public static int swapInterval = -1; public static boolean debuggl = false; public static void main(String[] args) { + NewtFactory.setUseEDT(true); // should be the default int type = USE_NEWT ; List threads = new ArrayList(); for(int i=0; i<args.length; i++) { @@ -333,8 +331,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo } catch (Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-debug")) { debuggl=true; - } else if(args[i].equals("-pumponce")) { - pumpOnce=true; } else if(args[i].equals("-1thread")) { oneThread=true; } else if(args[i].equals("-awt")) { @@ -348,15 +344,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo } if(!oneThread) { - Thread firstT = (Thread) threads.remove(0); - for(Iterator i = threads.iterator(); i.hasNext(); ) { ((Thread)i.next()).start(); } - // always run the first on main .. - firstT.run(); - boolean done = false; while(!done) { @@ -377,9 +368,6 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo ((Thread)i.next()).run(); } while (threads.size()>0) { - if(pumpOnce) { - GLWindow.runCurrentThreadPumpMessage(); - } for(Iterator i = threads.iterator(); i.hasNext(); ) { RedSquare app = (RedSquare) i.next(); if(app.shouldQuit()) { |