From 6c0ad949be979d5fed95a1166d59100f7bf5580f Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * If a {@link javax.media.opengl.GLAnimatorControl} is registered, or if it's not animating, the default situation,
+ * If no {@link javax.media.opengl.GLAnimatorControl} is registered, or if it is not animating, the default situation,
* or if the current thread is the animator thread,
- * a {@link #display()} call has to be issued after enqueue the GLRunnable
.
- * No extra synchronization must be performed in case wait
is true, since it is executed in the current thread.
GLRunnable
.wait
is true, since it is executed in the current thread.
*
* If {@link javax.media.opengl.GLAnimatorControl} is registered and is animating,
- * no call of {@link #display()} must be issued, since the animator thread will performs it.
- * If wait
is true, the implementation must wait until the GLRunnable
is executed.
+ * no {@link #display()} call is issued, since the animator thread performs it.
+ * If wait
is true, the implementation waits until the GLRunnable
is executed.
*
ARB_create_context
related: flag forward compatible */
protected static final int CTX_OPTION_FORWARD = 1 << 4;
- /** ARB_create_context
related: not flag forward compatible */
+ /** ARB_create_context
related: flag not forward compatible */
protected static final int CTX_OPTION_ANY = 1 << 5;
/** ARB_create_context
related: flag debug */
- protected static final int CTX_OPTION_DEBUG = 1 << 6;
+ public static final int CTX_OPTION_DEBUG = 1 << 6;
/** GLContext {@link com.jogamp.gluegen.runtime.ProcAddressTable} caching related: GL software implementation */
protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 0;
@@ -419,6 +420,20 @@ public abstract class GLContext {
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
+ /**
+ * @return Additional context creation flags, supported: {@link GLContext#CTX_OPTION_DEBUG}.
+ */
+ public abstract int getContextCreationFlags();
+
+ /**
+ * @param flags Additional context creation flags, supported: {@link GLContext#CTX_OPTION_DEBUG}.
+ * Unsupported flags are masked out.
+ * Only affects this context state if not created yet via {@link #makeCurrent()}.
+ * @see #enableGLDebugMessage(boolean)
+ * @see GLAutoDrawable#setContextCreationFlags(int)
+ */
+ public abstract void setContextCreationFlags(int flags);
+
/**
* Returns a valid OpenGL version string, ie@@ -516,6 +531,87 @@ public abstract class GLContext { return isGL2ES2() ; } + /** + * @return The extension implementing the GLDebugOutput feature, + * either GL_ARB_debug_output or GL_AMD_debug_output. + * If unavailable or called before initialized via {@link #makeCurrent()}, null is returned. + */ + public abstract String getGLDebugMessageExtension(); + + /** + * @return true if the GLDebugOutput feature is enabled or not. + */ + public abstract boolean isGLDebugMessageEnabled(); + + /** + * Enables or disables the GLDebugOutput feature of extension GL_ARB_debug_output + * or GL_AMD_debug_output, if available. + * + *To enable the GLDebugOutput feature {@link #enableGLDebugMessage(boolean) enableGLDebugMessage(true)} + * or {@link #setContextCreationFlags(int) setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG}) + * shall be called before context creation via {@link #makeCurrent()}!
+ * + *In case {@link GLAutoDrawable} are being used, + * {@link GLAutoDrawable#setContextCreationFlags(int) glAutoDrawable.setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG}) + * shall be issued before context creation via {@link #makeCurrent()}!
+ * + *After context creation, the GLDebugOutput feature may be enabled or disabled at any time using this method.
+ * + * @param enable If true enables, otherwise disables the GLDebugOutput feature. + * + * @throws GLException if this context is not current or GLDebugOutput registration failed (enable) + * + * @see #setContextCreationFlags(int) + * @see #addGLDebugListener(GLDebugListener) + * @see GLAutoDrawable#setContextCreationFlags(int) + */ + public abstract void enableGLDebugMessage(boolean enable) throws GLException; + + /** + * Add {@link GLDebugListener}.
+ * + * @param listener {@link GLDebugListener} handling {@GLDebugMessage}s + * @see #enableGLDebugMessage(boolean) + * @see #removeGLDebugListener(GLDebugListener) + */ + public abstract void addGLDebugListener(GLDebugListener listener); + + /** + * Remove {@link GLDebugListener}.
+ * + * @param listener {@link GLDebugListener} handling {@GLDebugMessage}s + * @see #enableGLDebugMessage(boolean) + * @see #addGLDebugListener(GLDebugListener) + */ + public abstract void removeGLDebugListener(GLDebugListener listener); + + /** + * @return number of added {@link GLDebugListener}. If > 0, the GLDebugFeature is turned on, otherwise off. + * @see #enableGLDebugMessage(boolean) + */ + public abstract int getGLDebugListenerSize(); + + /** + * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, IntBuffer, boolean)} + * and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, IntBuffer, boolean)} of the GLDebugOutput feature. + * @see #enableGLDebugMessage(boolean) + */ + public abstract void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled); + + /** + * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, int[], int, boolean)} + * and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, int[], int, boolean)} of the GLDebugOutput feature. + * @see #enableGLDebugMessage(boolean) + */ + public abstract void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled); + + /** + * Generic entry for {@link GL2GL3#glDebugMessageInsertARB(int, int, int, int, int, String)} + * and {@link GL2GL3#glDebugMessageInsertAMD(int, int, int, int, String)} of the GLDebugOutput feature. + * @see #enableGLDebugMessage(boolean) + */ + public abstract void glDebugMessageInsert(int source, int type, int id, int severity, int length, String buf); + public static final int GL_VERSIONS[][] = { /* 0.*/ { -1 }, /* 1.*/ { 0, 1, 2, 3, 4, 5 }, @@ -750,7 +846,7 @@ public abstract class GLContext { public static String getGLVersion(int major, int minor, int ctp, String gl_version) { boolean needColon = false; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(major); sb.append("."); sb.append(minor); @@ -759,6 +855,7 @@ public abstract class GLContext { needColon = appendString(sb, "compatibility profile", needColon, 0 != ( CTX_PROFILE_COMPAT & ctp )); needColon = appendString(sb, "core profile", needColon, 0 != ( CTX_PROFILE_CORE & ctp )); needColon = appendString(sb, "forward compatible", needColon, 0 != ( CTX_OPTION_FORWARD & ctp )); + needColon = appendString(sb, "debug", needColon, 0 != ( CTX_OPTION_DEBUG & ctp )); needColon = appendString(sb, "any", needColon, 0 != ( CTX_OPTION_ANY & ctp )); needColon = appendString(sb, "new", needColon, 0 != ( CTX_IS_ARB_CREATED & ctp )); needColon = appendString(sb, "old", needColon, 0 == ( CTX_IS_ARB_CREATED & ctp )); @@ -785,7 +882,7 @@ public abstract class GLContext { return "0x" + Long.toHexString(hex); } - private static boolean appendString(StringBuffer sb, String string, boolean needColon, boolean condition) { + private static boolean appendString(StringBuilder sb, String string, boolean needColon, boolean condition) { if(condition) { if(needColon) { sb.append(", "); diff --git a/src/jogl/classes/javax/media/opengl/GLDebugListener.java b/src/jogl/classes/javax/media/opengl/GLDebugListener.java new file mode 100644 index 000000000..8887d022a --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/GLDebugListener.java @@ -0,0 +1,44 @@ +/** + * Copyright 2011 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package javax.media.opengl; + +/** + * Listener for {@link GLDebugMessage}s. + * + *One can enable GLDebugOutput via {@link GLContext#enableGLDebugMessage(boolean)} + * and add listeners via {@link GLContext#addGLDebugListener(GLDebugListener)}. + */ +public interface GLDebugListener { + /** + * Handle {@link GLDebugMessage} message sent from native GL implementation. + * + *
Since this method is invoked directly by the GL implementation, it shall + * return as fast as possible.
+ */ + void messageSent(GLDebugMessage event); +} diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java new file mode 100644 index 000000000..3ab0683c6 --- /dev/null +++ b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java @@ -0,0 +1,248 @@ +/** + * Copyright 2011 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package javax.media.opengl; + +import com.jogamp.common.os.Platform; + +public class GLDebugMessage { + final GLContext source; + final long when; + final int dbgSource; + final int dbgType; + final int dbgId; + final int dbgSeverity; + final String dbgMsg; + + /** + * @param source The source of the event + * @param when The time of the event + * @param dbgSource The ARB source + * @param dbgType The ARB type + * @param dbgId The ARB id + * @param dbgSeverity The ARB severity level + * @param dbgMsg The debug message + */ + public GLDebugMessage(GLContext source, long when, int dbgSource, int dbgType, int dbgId, int dbgSeverity, String dbgMsg) { + this.source = source; + this.when = when; + this.dbgSource = dbgSource; + this.dbgType = dbgType; + this.dbgId = dbgId; + this.dbgSeverity = dbgSeverity; + this.dbgMsg = dbgMsg; + } + + /** + * + * @param source + * @param when + * @param dbgId + * @param amdDbgCategory + * @param dbgSeverity AMD severity level equals ARB severity level (value and semantic) + * @param dbgMsg + * @return + */ + public static GLDebugMessage translateAMDEvent(GLContext source, long when, int dbgId, int amdDbgCategory, int dbgSeverity, String dbgMsg) { + int dbgSource, dbgType; + + // AMD category == ARB source/type + switch(amdDbgCategory) { + case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_API_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR_ARB; + break; + + // + // def source / other type + // + + case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER_ARB; + break; + + case GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER_ARB; + break; + + case GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_APPLICATION_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER_ARB; + break; + + + // + // other source / def type + // + + case GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB; + break; + + case GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB; + break; + + case GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE_ARB; + break; + + case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD: + default: + dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER_ARB; + dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER_ARB; + } + + return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg); + } + + public static int translateARB2AMDCategory(int dbgSource, int dbgType) { + switch (dbgSource) { + case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: + return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD; + + case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: + return GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD; + + case GL2GL3.GL_DEBUG_SOURCE_APPLICATION_ARB: + return GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD; + } + + switch(dbgType) { + case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: + return GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD; + + case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: + return GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD; + + case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE_ARB: + return GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD; + } + + return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD; + } + + public GLContext getSource() { + return source; + } + + public long getWhen() { + return when; + } + + public int getDbgSource() { + return dbgSource; + } + + public int getDbgType() { + return dbgType; + } + + public int getDbgId() { + return dbgId; + } + + public int getDbgSeverity() { + return dbgSeverity; + } + + public String getDbgMsg() { + return dbgMsg; + } + + public StringBuilder toString(StringBuilder sb) { + final String crtab = Platform.getNewline()+"\t"; + if(null==sb) { + sb = new StringBuilder(); + } + sb.append("GLDebugEvent[ id "); + toHexString(sb, dbgId) + .append(crtab).append("type ").append(getDbgTypeString(dbgType)) + .append(crtab).append("severity ").append(getDbgSeverityString(dbgSeverity)) + .append(crtab).append("source ").append(getDbgSourceString(dbgSource)) + .append(crtab).append("msg ").append(dbgMsg) + .append(crtab).append("when ").append(when); + if(null != source) { + sb.append(crtab).append("source ").append(source.getGLVersion()).append(" - hash 0x").append(Integer.toHexString(source.hashCode())); + } + sb.append("]"); + return sb; + } + + public String toString() { + return toString(null).toString(); + } + + public static String getDbgSourceString(int dbgSource) { + switch(dbgSource) { + case GL2GL3.GL_DEBUG_SOURCE_API_ARB: return "GL API"; + case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: return "GLSL or extension compiler"; + case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: return "Native Windowing binding"; + case GL2GL3.GL_DEBUG_SOURCE_THIRD_PARTY_ARB: return "Third party"; + case GL2GL3.GL_DEBUG_SOURCE_APPLICATION_ARB: return "Application"; + case GL2GL3.GL_DEBUG_SOURCE_OTHER_ARB: return "generic"; + default: return "Unknown (" + toHexString(dbgSource) + ")"; + } + } + + public static String getDbgTypeString(int dbgType) { + switch(dbgType) { + case GL2GL3.GL_DEBUG_TYPE_ERROR_ARB: return "Error"; + case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: return "Warning: marked for deprecation"; + case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: return "Warning: undefined behavior"; + case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE_ARB: return "Warning: implementation dependent performance"; + case GL2GL3.GL_DEBUG_TYPE_PORTABILITY_ARB: return "Warning: vendor-specific extension use"; + case GL2GL3.GL_DEBUG_TYPE_OTHER_ARB: return "Warning: generic"; + default: return "Unknown (" + toHexString(dbgType) + ")"; + } + } + + public static String getDbgSeverityString(int dbgSeverity) { + switch(dbgSeverity) { + case GL2GL3.GL_DEBUG_SEVERITY_HIGH_ARB: return "High: dangerous undefined behavior"; + case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM_ARB: return "Medium: Severe performance/deprecation/other warnings"; + case GL2GL3.GL_DEBUG_SEVERITY_LOW_ARB: return "Low: Performance warnings (redundancy/undefined)"; + default: return "Unknown (" + toHexString(dbgSeverity) + ")"; + } + } + + public static StringBuilder toHexString(StringBuilder sb, int i) { + if(null==sb) { + sb = new StringBuilder(); + } + return sb.append("0x").append(Integer.toHexString(i)); + } + public static String toHexString(int i) { + return "0x"+Integer.toHexString(i); + } + +} 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) { -- cgit v1.2.3