diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 11 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 167d4c64b..ee2686fd4 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -78,6 +78,8 @@ public abstract class GLContextImpl extends GLContext { */ private String contextFQN; + private int additionalCtxCreationFlags; + // Cache of the functions that are available to be called at the current // moment in time protected ExtensionAvailabilityCache extensionAvailability; @@ -90,8 +92,6 @@ public abstract class GLContextImpl extends GLContext { private GLBufferSizeTracker bufferSizeTracker; // Singleton - Set by GLContextShareSet private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker(); private GLStateTracker glStateTracker = new GLStateTracker(); - /** currently only {@link GLContext#CTX_OPTION_DEBUG} is supported */ - private int additionalCtxCreationFlags = 0; private GLDebugMessageHandler glDebugHandler = null; protected GLDrawableImpl drawable; @@ -377,6 +377,7 @@ public abstract class GLContextImpl extends GLContext { if (null == getGLDrawable().getChosenGLCapabilities()) { throw new GLException("drawable has no chosen GLCapabilities: "+getGLDrawable()); } + additionalCtxCreationFlags |= DEBUG_GL ? GLContext.CTX_OPTION_DEBUG : 0 ; } lockConsiderFailFast(); @@ -406,11 +407,12 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG_GL) { gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ); + glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener()); } if(TRACE_GL) { gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ); } - glDebugHandler.init(0 != (additionalCtxCreationFlags & GLContext.CTX_OPTION_DEBUG)); + glDebugHandler.init(0 != (additionalCtxCreationFlags & GLContext.CTX_OPTION_DEBUG)); } /* FIXME: refactor dependence on Java 2D / JOGL bridge @@ -587,8 +589,7 @@ public abstract class GLContextImpl extends GLContext { } } - private final void createContextARBMapVersionsAvailable(int reqMajor, boolean compat) - { + private final void createContextARBMapVersionsAvailable(int reqMajor, boolean compat) { resetStates(); long _context; diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index 70f523156..f67c916ea 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -234,6 +234,12 @@ public class GLDebugMessageHandler { } } + public static class StdErrGLDebugListener implements GLDebugListener { + public void messageSent(GLDebugMessage event) { + System.err.println(event); + } + } + // // native -> java // |