summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl/macosx
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-05-28 23:40:58 +0000
committerKenneth Russel <[email protected]>2006-05-28 23:40:58 +0000
commit9c6946c4cf89fd91493a0c16160db5c84f48c614 (patch)
treea7a03d7ddbe649dbc8703161265917a53bf75c9e /src/classes/com/sun/opengl/impl/macosx
parent833d0c87aeb985dcdb34367d6803ef2beae515b3 (diff)
Fixed Issue 224: External context dosen't work with GLCanvas
Added short-circuiting of logic to prevent the current GLContext from being released due to makeCurrent() of an external GLContext. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@784 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/macosx')
-rw-r--r--src/classes/com/sun/opengl/impl/macosx/MacOSXExternalGLContext.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXExternalGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXExternalGLContext.java
index 7a0b53a98..ceda14f3b 100644
--- a/src/classes/com/sun/opengl/impl/macosx/MacOSXExternalGLContext.java
+++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXExternalGLContext.java
@@ -45,6 +45,7 @@ import com.sun.opengl.impl.*;
public class MacOSXExternalGLContext extends MacOSXGLContext {
private boolean firstMakeCurrent = true;
private boolean created = true;
+ private GLContext lastContext;
public MacOSXExternalGLContext() {
super(null, null);
@@ -74,6 +75,23 @@ public class MacOSXExternalGLContext extends MacOSXGLContext {
return true;
}
+ 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 {
if (firstMakeCurrent) {
firstMakeCurrent = false;