summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsg215889 <[email protected]>2009-07-30 20:30:04 -0700
committersg215889 <[email protected]>2009-07-30 20:30:04 -0700
commit9cd6f0ef78faf97896662efd3b6ed96b17c58570 (patch)
tree9ef6cc44efe66be67a8364896156376f56fee1b4
parent943d348f37496f4ea1bd96babe7e9a9cdde2aca3 (diff)
RedSquare: Add '-vsync' param; Use proper default GL2ES[12] profile.
-rwxr-xr-xsrc/demos/es1/RedSquare.java9
-rwxr-xr-xsrc/demos/es2/RedSquare.java14
2 files changed, 18 insertions, 5 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java
index b8592d8..77cbc59 100755
--- a/src/demos/es1/RedSquare.java
+++ b/src/demos/es1/RedSquare.java
@@ -164,6 +164,7 @@ 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);
System.err.println(glp+" Entering initialization");
System.err.println(glp+" GL Profile: "+gl.getGLProfile());
@@ -171,6 +172,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);
glu = GLU.createGLU();
@@ -246,12 +248,15 @@ 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 void main(String[] args) {
int type = USE_NEWT ;
List threads = new ArrayList();
for(int i=0; i<args.length; i++) {
- if(args[i].equals("-pumponce")) {
+ if(args[i].equals("-vsync")) {
+ vsync = true;
+ } else if(args[i].equals("-pumponce")) {
pumpOnce=true;
} else if(args[i].equals("-1thread")) {
oneThread=true;
@@ -262,7 +267,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
}
}
if(threads.size()==0) {
- threads.add(new RedSquare(null, type));
+ threads.add(new RedSquare(GLProfile.GL2ES1, type));
}
if(!oneThread) {
diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java
index 3389204..341e177 100755
--- a/src/demos/es2/RedSquare.java
+++ b/src/demos/es2/RedSquare.java
@@ -179,12 +179,17 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
public void init(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
- glu = GLU.createGLU();
+ gl.setSwapInterval(vsync?1:0);
+
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));
+ glu = GLU.createGLU();
+
pmvMatrix = new PMVMatrix();
initShader(gl);
@@ -299,12 +304,15 @@ 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 void main(String[] args) {
int type = USE_NEWT ;
List threads = new ArrayList();
for(int i=0; i<args.length; i++) {
- if(args[i].equals("-pumponce")) {
+ if(args[i].equals("-vsync")) {
+ vsync = true;
+ } else if(args[i].equals("-pumponce")) {
pumpOnce=true;
} else if(args[i].equals("-1thread")) {
oneThread=true;
@@ -315,7 +323,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
}
}
if(threads.size()==0) {
- threads.add(new RedSquare(null, type));
+ threads.add(new RedSquare(GLProfile.GL2ES2, type));
}
if(!oneThread) {