aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/jogl/impl/x11')
-rw-r--r--src/net/java/games/jogl/impl/x11/X11GLContext.java17
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java1
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java1
-rw-r--r--src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java1
4 files changed, 20 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java
index e3bb4ce72..40e462fb3 100644
--- a/src/net/java/games/jogl/impl/x11/X11GLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLContext.java
@@ -59,6 +59,11 @@ public abstract class X11GLContext extends GLContext {
// OpenGL functions.
private GLProcAddressTable glProcAddressTable;
private static boolean haveResetGLXProcAddressTable;
+ // Cache the most recent value of the "display" variable (which we
+ // only guarantee to be valid in between makeCurrent / free pairs)
+ // so that we can implement displayImpl() (which must be done when
+ // the context is not current)
+ protected long mostRecentDisplay;
static {
functionNameMap = new HashMap();
@@ -167,6 +172,18 @@ public abstract class X11GLContext extends GLContext {
}
}
+ protected void destroyImpl() throws GLException {
+ if (context != 0) {
+ if (!GLX.glXDestroyContext(mostRecentDisplay, context)) {
+ throw new GLException("Unable to delete OpenGL context");
+ }
+ if (DEBUG) {
+ System.err.println("!!! Destroyed OpenGL context " + context);
+ }
+ context = 0;
+ }
+ }
+
public abstract void swapBuffers() throws GLException;
protected long dynamicLookupFunction(String glFuncName) {
diff --git a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
index 8c88b0225..0290f8d44 100644
--- a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
@@ -129,6 +129,7 @@ public class X11OffscreenGLContext extends X11GLContext {
pendingOffscreenResize = false;
}
}
+ mostRecentDisplay = display;
return super.makeCurrent(initAction);
}
diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java
index 911fc3740..1b5f54979 100644
--- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java
@@ -189,6 +189,7 @@ public class X11OnscreenGLContext extends X11GLContext {
visualID = 0;
return false;
}
+ mostRecentDisplay = display;
return true;
}
diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
index ccbba8b92..5ab976870 100644
--- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
@@ -217,6 +217,7 @@ public class X11PbufferGLContext extends X11GLContext {
// Set up instance variables
this.display = display;
+ mostRecentDisplay = display;
this.parentContext = parentContext;
buffer = tmpBuffer;
this.fbConfig = fbConfig;