How to use the Debug and Trace GL Pipeline and Debug GL Context: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
if(glDebug) { | if(glDebug) { | ||
try { | try { | ||
// Debug .. | |||
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); | gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); | ||
} catch (Exception e) {e.printStackTrace();} | } catch (Exception e) {e.printStackTrace();} |
Latest revision as of 10:59, 20 December 2013
Debug and Trace GL Pipeline
class MyGLEvenListener extends GLEvenListener { static final boolean glDebug = .. ; // enable at your leisure static final boolean glTrace = .. ; // enable at your leisure static boolean once = false; public void init(GLAutoDrawable drawable) { GL2ES2 gl2es2; if( !once ) { once = true; GL gl = drawable.getGL(); if(glDebug) { try { // Debug .. gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); } catch (Exception e) {e.printStackTrace();} } if(glTrace) { try { // Trace .. gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); } catch (Exception e) {e.printStackTrace();} } gl2es2 = gl.getGL2ES2(); } else { gl2es2 = drawable.getGL().getGL2ES2(); } } }
You also can enable 'JVM wide' DebugGL by simply setting property jogl.debug.DebugGL
:
-Djogl.debug.DebugGL
This will also enable the native debug context, see below.
You also can enable 'JVM wide' TraceGL by simply setting property jogl.debug.TraceGL
:
-Djogl.debug.TraceGL
Debug GL Context
If you like to use the native debug context you would need to configure the not yet natively created GLContext:
GLContext ctx = ...; // not yet natively created by 1st makeCurrent() ctx.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
.. or using an GLAutoDrawable implementation:
GLWindow glWin = ... ; // newly create one, not yet visible glWin.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);