diff options
Diffstat (limited to 'src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java')
-rwxr-xr-x | src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java index cd51f4eb1..a73cc7ac4 100755 --- a/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java @@ -47,6 +47,7 @@ import com.sun.opengl.impl.*; public class WindowsExternalGLContext extends WindowsGLContext { private boolean firstMakeCurrent = true; private boolean created = true; + private GLContext lastContext; public WindowsExternalGLContext() { super(null, null, true); @@ -61,6 +62,23 @@ public class WindowsExternalGLContext extends WindowsGLContext { resetGLFunctionAvailability(); } + 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; |