diff options
author | Sven Gothel <sgothel@jausoft.com> | 2011-04-05 01:12:51 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2011-04-05 01:12:51 +0200 |
commit | 2e71f18aa514622b855a7f463a9d9f82b9e66d9f (patch) | |
tree | 450c86f57819db0b37a1e46ee9957f60e7398e97 | |
parent | b44288b26e8ac6de0593db349725c2a288bb520a (diff) |
GLContext: Added java.debug.DebugGL and java.debug.TraceGL to enable debug and trace pipeline.
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 9 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 12 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index b859dee00..c5f0bc83e 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -58,7 +58,12 @@ import jogamp.opengl.Debug; abstraction provides a stable object which clients can use to refer to a given context. */ public abstract class GLContext { - protected static final boolean DEBUG0 = Debug.debug("GLContext"); + /** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */ + public final static boolean DEBUG_GL = Debug.debug("DebugGL"); + /** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */ + public final static boolean TRACE_GL = Debug.debug("TraceGL"); + + protected static final boolean DEBUG = Debug.debug("GLContext"); /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */ public static final int CONTEXT_NOT_CURRENT = 0; @@ -601,7 +606,7 @@ public abstract class GLContext { throw new InternalError("Already set: "+devKey); } deviceVersionsAvailableSet.add(devKey); - if (DEBUG0) { + if (DEBUG) { String msg = getThreadName() + ": !!! createContextARB: SET mappedVersionsAvailableSet "+devKey; // Throwable t = new Throwable(msg); // t.printStackTrace(); diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index d5059eb74..373f41699 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -59,11 +59,10 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLException; +import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GLProfile; public abstract class GLContextImpl extends GLContext { - protected static final boolean DEBUG = Debug.debug("GLContext"); - protected GLContextLock lock = new GLContextLock(); /** @@ -369,6 +368,13 @@ public abstract class GLContextImpl extends GLContext { // check if the drawable's and the GL's GLProfile are equal // throws an GLException if not getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile()); + + if(DEBUG_GL) { + gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); + } + if(TRACE_GL) { + gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); + } } setCurrent(this); @@ -706,7 +712,7 @@ public abstract class GLContextImpl extends GLContext { /** Create the GL for this context. */ protected GL createGL(GLProfile glp) { GL gl = (GL) createInstance(glp, "Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { glp, this } ); - + /* FIXME: refactor dependence on Java 2D / JOGL bridge if (tracker != null) { gl.setObjectTracker(tracker); |