diff options
author | sg215889 <[email protected]> | 2009-07-30 22:10:34 -0700 |
---|---|---|
committer | sg215889 <[email protected]> | 2009-07-30 22:10:34 -0700 |
commit | 56cdd9e61e28fb7fc542163d4009f1de3b397904 (patch) | |
tree | 1caba23ff14afffd0811c11480f7b783432e74cd /src/demos | |
parent | 9cd6f0ef78faf97896662efd3b6ed96b17c58570 (diff) |
RedSquare: Param '-vsync' -> '-swapi <integer>' ; Show getSwapInterval()
Diffstat (limited to 'src/demos')
-rwxr-xr-x | src/demos/es1/RedSquare.java | 15 | ||||
-rwxr-xr-x | src/demos/es2/RedSquare.java | 14 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 77cbc59..8931b6c 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -164,7 +164,9 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void init(GLAutoDrawable drawable) { GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL()); - gl.setSwapInterval(vsync?1:0); + if(swapInterval>=0) { + gl.setSwapInterval(swapInterval); + } System.err.println(glp+" Entering initialization"); System.err.println(glp+" GL Profile: "+gl.getGLProfile()); @@ -172,7 +174,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo 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+" vsync:" + vsync); + System.err.println(glp+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")"); glu = GLU.createGLU(); @@ -248,14 +250,17 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public static boolean oneThread = false; public static boolean pumpOnce = true; - public static boolean vsync = false; + public static int swapInterval = -1; public static void main(String[] args) { int type = USE_NEWT ; List threads = new ArrayList(); for(int i=0; i<args.length; i++) { - if(args[i].equals("-vsync")) { - vsync = true; + if(args[i].equals("-swapi")) { + i++; + try { + swapInterval = Integer.parseInt(args[i]); + } catch (Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-pumponce")) { pumpOnce=true; } else if(args[i].equals("-1thread")) { diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index 341e177..5c74a4e 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -179,7 +179,9 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void init(GLAutoDrawable drawable) { GL2ES2 gl = drawable.getGL().getGL2ES2(); - gl.setSwapInterval(vsync?1:0); + if(swapInterval>=0) { + gl.setSwapInterval(swapInterval); + } System.err.println(glp+" Entering initialization"); System.err.println(glp+" GL Profile: "+gl.getGLProfile()); @@ -187,6 +189,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo 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()+")"); glu = GLU.createGLU(); @@ -304,14 +307,17 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public static boolean oneThread = false; public static boolean pumpOnce = true; - public static boolean vsync = false; + public static int swapInterval = -1; public static void main(String[] args) { int type = USE_NEWT ; List threads = new ArrayList(); for(int i=0; i<args.length; i++) { - if(args[i].equals("-vsync")) { - vsync = true; + if(args[i].equals("-swapi")) { + i++; + try { + swapInterval = Integer.parseInt(args[i]); + } catch (Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-pumponce")) { pumpOnce=true; } else if(args[i].equals("-1thread")) { |