aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/awt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-24 12:21:36 +0200
committerSven Gothel <[email protected]>2011-04-24 12:21:36 +0200
commit6c0ad949be979d5fed95a1166d59100f7bf5580f (patch)
treed69242fabf1f066d43418612209597616fba6cdd /src/jogl/classes/javax/media/opengl/awt
parentea819ff768d507c37a981c1ab0bdc0cad32c6a87 (diff)
Add unified support for GL_ARB_debug_output and GL_AMD_debug_output.
If GL_ARB_debug_output is not available, but GL_AMD_debug_output exist, fallback to the latter, offering generic aliased methods translating the delta (AMD category <-> ARB source/type). Generic aliased methods reside in GLContext* Enable/Disable via GLContext and GLAutoDrawable. To enable the GLDebugOutput feature GLContext.enableGLDebugMessage(true) or GLContext.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG) shall be called _before_ context creation via GLContext.makeCurrent()! In case GLAutoDrawable is being used, GLAutoDrawable.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG) shall be issued before context creation via GLContext.makeCurrent()!. After context creation, the GLDebugOutput feature may be enabled or disabled at any time using this method. Verify both unit tests for usability.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java15
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java18
2 files changed, 31 insertions, 2 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index dc439f334..160cdce51 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -152,7 +152,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// copy of the cstr args, mainly for recreation
private GLCapabilitiesImmutable capsReqUser;
private GLCapabilitiesChooser chooser;
- private GLContext shareWith;
+ private GLContext shareWith;
+ private int additionalCtxCreationFlags = 0;
private GraphicsDevice device;
private AWTWindowClosingProtocol awtWindowClosingProtocol =
@@ -525,6 +526,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
.createGLDrawable(NativeWindowFactory.getNativeWindow(this, awtConfig));
context = (GLContextImpl) drawable.createContext(shareWith);
context.setSynchronized(true);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
}
// before native peer is valid: X11
@@ -660,6 +662,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void setContext(GLContext ctx) {
context=(GLContextImpl)ctx;
+ if(null != context) {
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ }
}
public GLContext getContext() {
@@ -696,6 +701,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
maybeDoSingleThreadedWorkaround(swapBuffersOnEventDispatchThreadAction, swapBuffersAction);
}
+ public void setContextCreationFlags(int flags) {
+ additionalCtxCreationFlags = flags;
+ }
+
+ public int getContextCreationFlags() {
+ return additionalCtxCreationFlags;
+ }
+
public GLProfile getGLProfile() {
return capsReqUser.getGLProfile();
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index d58ad0304..2d58584f7 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -136,6 +136,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private GLDrawableFactoryImpl factory;
private GLCapabilitiesChooser chooser;
private GLContext shareWith;
+ private int additionalCtxCreationFlags = 0;
+
// Width of the actual GLJPanel
private int panelWidth = 0;
private int panelHeight = 0;
@@ -488,6 +490,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if (backend == null) {
return;
}
+ if(null != ctx) {
+ ctx.setContextCreationFlags(additionalCtxCreationFlags);
+ }
backend.setContext(ctx);
}
@@ -531,7 +536,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// Swing portion of the GLJPanel in any of the rendering paths.
return true;
}
-
+
public void swapBuffers() {
// In the current implementation this is a no-op. Both the pbuffer
// and pixmap based rendering paths use a single-buffered surface
@@ -540,6 +545,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// Swing portion of the GLJPanel in any of the rendering paths.
}
+ public void setContextCreationFlags(int flags) {
+ additionalCtxCreationFlags = flags;
+ }
+
+ public int getContextCreationFlags() {
+ return additionalCtxCreationFlags;
+ }
+
/** For a translucent GLJPanel (one for which {@link #setOpaque
setOpaque}(false) has been called), indicates whether the
application should preserve the OpenGL color buffer
@@ -1023,6 +1036,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
Math.max(1, panelHeight));
offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith);
offscreenContext.setSynchronized(true);
+ offscreenContext.setContextCreationFlags(additionalCtxCreationFlags);
+
isInitialized = true;
}
@@ -1108,6 +1123,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
pbufferWidth,
pbufferHeight,
shareWith);
+ pbuffer.setContextCreationFlags(additionalCtxCreationFlags);
pbuffer.addGLEventListener(updater);
isInitialized = true;
} catch (GLException e) {