diff options
author | Sven Gothel <[email protected]> | 2009-08-02 05:15:22 -0700 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-08-02 05:15:22 -0700 |
commit | 911ead38d92310bcce1e1f79ff0d1f57a4748ced (patch) | |
tree | 64bd48b7bf5e97edec60b822b415f0867b169038 /src/demos/es1/RedSquare.java | |
parent | f1ac38bdf71d0f9c8c2c34650f119bf3cc9b8900 (diff) |
RedSquare: '-debug' option enables Debug/Trace using new GLPipelineFactory
Diffstat (limited to 'src/demos/es1/RedSquare.java')
-rwxr-xr-x | src/demos/es1/RedSquare.java | 31 |
1 files changed, 30 insertions, 1 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")) { |