summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-08-02 05:15:22 -0700
committerSven Gothel <[email protected]>2009-08-02 05:15:22 -0700
commit911ead38d92310bcce1e1f79ff0d1f57a4748ced (patch)
tree64bd48b7bf5e97edec60b822b415f0867b169038 /src/demos
parentf1ac38bdf71d0f9c8c2c34650f119bf3cc9b8900 (diff)
RedSquare: '-debug' option enables Debug/Trace using new GLPipelineFactory
Diffstat (limited to 'src/demos')
-rwxr-xr-xsrc/demos/es1/RedSquare.java31
-rwxr-xr-xsrc/demos/es2/RedSquare.java22
2 files changed, 42 insertions, 11 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java
index 17dd69e..3123a9d 100755
--- a/src/demos/es1/RedSquare.java
+++ b/src/demos/es1/RedSquare.java
@@ -163,7 +163,20 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
private FloatBuffer vertices;
public void init(GLAutoDrawable drawable) {
- GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL());
+ GL _gl = drawable.getGL();
+
+ if(debugffemu) {
+ debuggl = false;
+ try {
+ // Debug ..
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) );
+
+ // Trace ..
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) );
+ } catch (Exception e) {e.printStackTrace();}
+ }
+
+ GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(_gl);
if(swapInterval>=0) {
gl.setSwapInterval(swapInterval);
}
@@ -179,6 +192,16 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
System.err.println(glp+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")");
System.err.println(glp+" GLU: " + glu);
+ if(debuggl) {
+ try {
+ // Debug ..
+ gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) );
+
+ // Trace ..
+ gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) );
+ } catch (Exception e) {e.printStackTrace();}
+ }
+
// Allocate vertex arrays
colors = BufferUtil.newFloatBuffer(16);
vertices = BufferUtil.newFloatBuffer(12);
@@ -252,6 +275,8 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
public static boolean oneThread = false;
public static boolean pumpOnce = true;
public static int swapInterval = -1;
+ public static boolean debuggl = false;
+ public static boolean debugffemu = false;
public static void main(String[] args) {
int type = USE_NEWT ;
@@ -262,6 +287,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
try {
swapInterval = Integer.parseInt(args[i]);
} catch (Exception ex) { ex.printStackTrace(); }
+ } else if(args[i].equals("-debug")) {
+ debuggl=true;
+ } else if(args[i].equals("-debugff")) {
+ debugffemu=true;
} 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 8b23ddc..da4505c 100755
--- a/src/demos/es2/RedSquare.java
+++ b/src/demos/es2/RedSquare.java
@@ -194,16 +194,15 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
System.err.println(glp+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")");
System.err.println(glp+" GLU: " + glu);
- /***
- // Debug ..
- DebugGL2ES2 gldbg = new DebugGL2ES2(gl);
- gl.getContext().setGL(gldbg);
- gl = gldbg;
-
- // Trace ..
- TraceGL2ES2 gltrace = new TraceGL2ES2(gl, System.err);
- gl.getContext().setGL(gltrace);
- gl = gltrace; **/
+ if(debuggl) {
+ try {
+ // Debug ..
+ gl = (GL2ES2) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, gl, null) );
+
+ // Trace ..
+ gl = (GL2ES2) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, gl, new Object[] { System.err } ) );
+ } catch (Exception e) {e.printStackTrace();}
+ }
pmvMatrix = new PMVMatrix();
@@ -320,6 +319,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
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) {
int type = USE_NEWT ;
@@ -330,6 +330,8 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo
try {
swapInterval = Integer.parseInt(args[i]);
} 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")) {