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 | |
parent | f1ac38bdf71d0f9c8c2c34650f119bf3cc9b8900 (diff) |
RedSquare: '-debug' option enables Debug/Trace using new GLPipelineFactory
-rwxr-xr-x | java-dbg-newt.sh | 2 | ||||
-rw-r--r-- | java-win32-gl2es12-dbg.bat | 5 | ||||
-rwxr-xr-x | src/demos/es1/RedSquare.java | 31 | ||||
-rwxr-xr-x | src/demos/es2/RedSquare.java | 22 |
4 files changed, 45 insertions, 15 deletions
diff --git a/java-dbg-newt.sh b/java-dbg-newt.sh index 2e12723..6c735e7 100755 --- a/java-dbg-newt.sh +++ b/java-dbg-newt.sh @@ -15,7 +15,7 @@ if [ $CPOK -eq 0 ] ; then echo No JOGL in CLASSPATH else # D_ARGS="-Dgluegen.debug.ProcAddressHelper=true -Dgluegen.debug.NativeLibrary=true -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" - D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" + D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogl.debug.GLSLState" if [ $MOSX -eq 1 ] ; then X_ARGS="-XstartOnFirstThread" fi diff --git a/java-win32-gl2es12-dbg.bat b/java-win32-gl2es12-dbg.bat index 9b99478..a0d3482 100644 --- a/java-win32-gl2es12-dbg.bat +++ b/java-win32-gl2es12-dbg.bat @@ -10,7 +10,7 @@ set LIB_DIR=jogl\lib set CP_GLUE=%JAR_DIR%\gluegen-rt.jar
REM set CP_JOGL=%JAR_DIR%\jogl.core.jar;%JAR_DIR%\jogl.util.jar;%JAR_DIR%\jogl.gl2es12.win.jar;%JAR_DIR%\jogl.util.fixedfuncemu.jar;%JAR_DIR%\jogl.gl2es12.dbg.jar;%JAR_DIR%\jogl.glu.tess.jar;%JAR_DIR%\jogl.glu.mipmap.jar;%JAR_DIR%\jogl.awt.jar;%JAR_DIR%\jogl.util.awt.jar
-set CP_JOGL=%JAR_DIR%\jogl.core.jar;%JAR_DIR%\jogl.gl2es12.win.jar;%JAR_DIR%\jogl.util.jar;%JAR_DIR%\jogl.gles2.dbg.jar
+set CP_JOGL=%JAR_DIR%\jogl.core.jar;%JAR_DIR%\jogl.gl2es12.win.jar;%JAR_DIR%\jogl.util.jar;%JAR_DIR%\jogl.gles2.dbg.jar;%JAR_DIR%\jogl.util.fixedfuncemu.jar
REM set CP_JOGL=%JAR_DIR%\jogl.core.jar;%JAR_DIR%\jogl.gl2.win.jar;%JAR_DIR%\jogl.util.jar;%JAR_DIR%\jogl.gles2.dbg.jar
REM set CP_NEWT=%JAR_DIR%\newt.all.jar
@@ -19,8 +19,7 @@ set CP_NEWT=%JAR_DIR%\newt.core.jar;%JAR_DIR%\newt.win.jar;%JAR_DIR%\newt.ogl.ja REM set CP_NWI=%JAR_DIR%\nativewindow.all.jar
set CP_NWI=%JAR_DIR%\nativewindow.core.jar
-REM set CP_DEMO=jogl-demos.jar;jogl-demos-util.jar;jogl-demos-data.jar
-set CP_DEMO=jogl-demos.jar
+set CP_DEMO=jogl-demos.jar;jogl-demos-util.jar;jogl-demos-data.jar
set CP_ALL=%CP_GLUE%;%CP_NWI%;%CP_JOGL%;%CP_NEWT%;%CP_DEMO%
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")) { |