How to use the Debug and Trace GL Pipeline and Debug GL Context

From JogampWiki
Revision as of 09:53, 20 December 2013 by Sgothel (talk | contribs) (Created page with '== Debug GL Pipeline == <pre> class MyGLEvenListener extends GLEvenListener { static boolean once = false; public void init(GLAutoDrawable drawable) { GL2ES2 gl2es2; …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Debug GL Pipeline

class MyGLEvenListener extends GLEvenListener {

  static boolean once = false;

  public void init(GLAutoDrawable drawable) {
    GL2ES2 gl2es2;
    if( !once ) {
      once = true;
      GL gl = drawable.getGL();
      gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
      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.

(Same goes for 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);