diff options
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 15 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 18 |
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) { |