aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com/sun/opengl/impl/x11')
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java b/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java
index 80d9c6f1a..89b769eee 100755
--- a/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java
+++ b/src/classes/com/sun/opengl/impl/x11/X11ExternalGLContext.java
@@ -45,6 +45,7 @@ import com.sun.opengl.impl.*;
public class X11ExternalGLContext extends X11GLContext {
private boolean firstMakeCurrent = true;
private boolean created = true;
+ private GLContext lastContext;
public X11ExternalGLContext() {
super(null, null);
@@ -65,6 +66,23 @@ public class X11ExternalGLContext extends X11GLContext {
protected void create() {
}
+ public int makeCurrent() throws GLException {
+ // Save last context if necessary to allow external GLContexts to
+ // talk to other GLContexts created by this library
+ GLContext cur = getCurrent();
+ if (cur != null && cur != this) {
+ lastContext = cur;
+ setCurrent(null);
+ }
+ return super.makeCurrent();
+ }
+
+ public void release() throws GLException {
+ super.release();
+ setCurrent(lastContext);
+ lastContext = null;
+ }
+
protected int makeCurrentImpl() throws GLException {
mostRecentDisplay = drawable.getDisplay();
if (firstMakeCurrent) {