aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-28 22:09:31 +0200
committerSven Gothel <[email protected]>2011-04-28 22:09:31 +0200
commit39a8ca392d7302831f5689979c4ce89145b732af (patch)
treec338e8565169b871bbe8830c752bd19283eec9b3 /src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
parent23bc6204b5e518e397e4ee4cdbe06f789970ee4f (diff)
GLContext GLDebugMessages: Add synchronous status/dumpStack; Remove length in aliased glDebugMessageInsert.
- GLDebugMessages add synchronous status - defaults to true - GLContext/GLDebugMessages add dumpStack() if jogl.debug.DebugGL is set - Remove param length in aliased glDebugMessageInsert.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
index f67c916ea..09be202dd 100644
--- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
+++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
@@ -78,6 +78,7 @@ public class GLDebugMessageHandler {
private int extType;
private long glDebugMessageCallbackProcAddress;
private boolean extAvailable;
+ private boolean synchronous;
// licefycle: enable - disable/EOL
private long handle;
@@ -94,6 +95,7 @@ public class GLDebugMessageHandler {
this.extType = 0;
this.extAvailable = false;
this.handle = 0;
+ this.synchronous = true;
}
public void init(boolean enable) {
@@ -176,7 +178,32 @@ public class GLDebugMessageHandler {
}
/**
- * @throws GLException if context not current or callback registration failed (enable)
+ * @see javax.media.opengl.GLContext#isGLDebugSynchronous()
+ */
+ public final boolean isSynchronous() { return synchronous; }
+
+ /**
+ * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean)
+ */
+ public final void setSynchronous(boolean synchronous) {
+ this.synchronous = synchronous;
+ if(isEnabled() && isExtensionARB()) {
+ setSynchronousImpl();
+ }
+ }
+ private final void setSynchronousImpl() {
+ if(synchronous) {
+ ctx.getGL().glEnable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+ } else {
+ ctx.getGL().glDisable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
+ }
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: synchronous "+synchronous);
+ }
+ }
+
+ /**
+ * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean)
*/
public final void enable(boolean enable) throws GLException {
ctx.validateCurrent();
@@ -186,6 +213,7 @@ public class GLDebugMessageHandler {
enableImpl(enable);
}
final void enableImpl(boolean enable) throws GLException {
+ setSynchronousImpl();
if(enable) {
if(0 == handle) {
handle = register0(glDebugMessageCallbackProcAddress, extType);
@@ -234,9 +262,17 @@ public class GLDebugMessageHandler {
}
}
- public static class StdErrGLDebugListener implements GLDebugListener {
+ public static class StdErrGLDebugListener implements GLDebugListener {
+ boolean threadDump;
+
+ public StdErrGLDebugListener(boolean threadDump) {
+ this.threadDump = threadDump;
+ }
public void messageSent(GLDebugMessage event) {
- System.err.println(event);
+ System.err.println(event);
+ if(threadDump) {
+ Thread.dumpStack();
+ }
}
}