aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-02 19:42:52 +0200
committerSven Gothel <[email protected]>2012-07-02 19:42:52 +0200
commiteed8508ae1132e5f45f788e9cb3f3d5a1050ac70 (patch)
treee1eec83da8dee44392407b59672134109fc63b6f /src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
parent08e3f9bff494a5366781328734e83ae0202696fa (diff)
GLAutoDrawable: Refine API doc; Use new abstract impl. GLAutoDrawableBase (GLWindow, ..); Add new GLAutoDrawableDelegate.
- Refine API doc - 'void setContext(GLContext)' -> 'GLContext setContext(GLContext)' - Add note to createContext(GLContext) override -Use new abstract impl. GLAutoDrawableBase, used by: - GLWindow - GLAutoDrawableDelegate - GLPbufferImpl - Add new GLAutoDrawableDelegate incl. unit test
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt/GLJPanel.java')
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 152326006..c6c7cf9a1 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -456,16 +456,20 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public void setContext(GLContext ctx) {
- if (backend == null) {
- return;
- }
- if(null != ctx) {
- ctx.setContextCreationFlags(additionalCtxCreationFlags);
- }
- backend.setContext(ctx);
+ public GLContext setContext(GLContext newCtx) {
+ if (backend == null) {
+ return null;
+ }
+ final GLContext oldCtx = backend.getContext();
+ final boolean newCtxCurrent = drawableHelper.switchContext(backend.getDrawable(), oldCtx, newCtx, additionalCtxCreationFlags);
+ backend.setContext(newCtx);
+ if(newCtxCurrent) {
+ newCtx.makeCurrent();
+ }
+ return oldCtx;
}
+
@Override
public GLContext getContext() {
if (backend == null) {
@@ -1160,7 +1164,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public void setContext(GLContext ctx) {
- if (pbuffer == null && Beans.isDesignTime()) {
+ if (pbuffer == null || Beans.isDesignTime()) {
return;
}
pbuffer.setContext(ctx);
@@ -1169,7 +1173,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public GLContext getContext() {
// Workaround for crashes in NetBeans GUI builder
- if (pbuffer == null && Beans.isDesignTime()) {
+ if (null == pbuffer || Beans.isDesignTime()) {
return null;
}
return pbuffer.getContext();