diff options
Diffstat (limited to 'src/demos/es2/RedSquare.java')
-rwxr-xr-x | src/demos/es2/RedSquare.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index a01a41a..37ef2be 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -50,7 +50,7 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener public void mouseWheelMoved(MouseEvent e) { } - private void start(String glprofile, int type) { + private void init(String glprofile, int type) { int width = 800; int height = 480; glp = GLProfile.GetProfile(glprofile); @@ -79,13 +79,21 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener // Size OpenGL to Video Surface window.setSize(width, height); // window.setFullscreen(true); - - start(); } catch (Throwable t) { t.printStackTrace(); } } + private void runInThread(String glprofile, int type) { + init(glprofile, type); + run(); + } + + private void start(String glprofile, int type) { + init(glprofile, type); + start(); + } + public void run() { System.err.println(glp+" RedSquare.run()"); try { @@ -255,19 +263,17 @@ public class RedSquare extends Thread implements MouseListener, GLEventListener public static void main(String[] args) { String glprofile = null; int type = USE_NEWT ; - int num=0; for(int i=args.length-1; i>=0; i--) { if(args[i].equals("-awt")) { type |= USE_AWT; } if(args[i].startsWith("-GL")) { + if(null!=glprofile) { + new RedSquare().start(glprofile, type); + } glprofile=args[i].substring(1); - new RedSquare().start(glprofile, type); - num++; } } - if(0==num) { - new RedSquare().start(glprofile, type); - } + new RedSquare().runInThread(glprofile, type); } } |