aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-02-21 08:34:02 +0000
committerKenneth Russel <[email protected]>2006-02-21 08:34:02 +0000
commit32e67c03dc9959b1d448eaf314639a3d36fd7f34 (patch)
treeb39529815c4fba1a642ce3599f2e94c8b9f7e2a6 /src/classes/com/sun/opengl
parent6b3eb7ba25d3ef0123f2f6f1987237e3596b6399 (diff)
Added support for calling makeCurrent() over and over again with
different contexts without explicitly calling release() git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@627 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl')
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 795b06e9a..a4eee6652 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -81,6 +81,21 @@ public abstract class GLContextImpl extends GLContext {
}
public int makeCurrent() throws GLException {
+ // Support calls to makeCurrent() over and over again with
+ // different contexts without releasing them
+ // Could implement this more efficiently without explicit
+ // releasing of the underlying context; would require more error
+ // checking during the makeCurrentImpl phase
+ GLContext current = getCurrent();
+ if (current != null) {
+ if (current == this) {
+ // Assume we don't need to make this context current again
+ return CONTEXT_CURRENT;
+ } else {
+ current.release();
+ }
+ }
+
lock.lock();
int res = 0;
try {