aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-04 02:37:52 +0100
committerSven Gothel <[email protected]>2010-11-04 02:37:52 +0100
commitdc4a31054dc83073ccd5093dfb947dbade13789b (patch)
treeb774ec5caf1da033fcae82b3e4163c7ee171ea39
parent4d56491c3f8e76676e1c860d018bbe991d28ebac (diff)
JOGL/X11: Decorate glxMakeContextCurrent calls from makeCurrentImpl/releaseImpl with X11 Error Handle
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
index 494972e7a..d80da1dd4 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
@@ -351,24 +351,34 @@ public abstract class X11GLXContext extends GLContextImpl {
protected void makeCurrentImpl(boolean newCreated) throws GLException {
long dpy = drawable.getNativeSurface().getDisplayHandle();
- if (GLX.glXGetCurrentContext() != contextHandle) {
- if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context current: "+this);
+ if (GLX.glXGetCurrentContext() != contextHandle) {
+ X11Util.setX11ErrorHandler(true);
+ try {
+ if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
+ throw new GLException("Error making context current: "+this);
+ }
+ } finally {
+ X11Util.setX11ErrorHandler(false);
}
if (DEBUG && (VERBOSE || newCreated)) {
- System.err.println(getThreadName() + ": glXMakeCurrent(display " +
- toHexString(dpy)+
- ", drawable " + toHexString(drawable.getHandle()) +
- ", drawableRead " + toHexString(drawableRead.getHandle()) +
- ", context " + toHexString(contextHandle) + ") succeeded");
+ System.err.println(getThreadName() + ": glXMakeCurrent(display " +
+ toHexString(dpy)+
+ ", drawable " + toHexString(drawable.getHandle()) +
+ ", drawableRead " + toHexString(drawableRead.getHandle()) +
+ ", context " + toHexString(contextHandle) + ") succeeded");
}
}
}
protected void releaseImpl() throws GLException {
long display = drawable.getNativeSurface().getDisplayHandle();
- if (!glXMakeContextCurrent(display, 0, 0, 0)) {
- throw new GLException("Error freeing OpenGL context");
+ X11Util.setX11ErrorHandler(true);
+ try {
+ if (!glXMakeContextCurrent(display, 0, 0, 0)) {
+ throw new GLException("Error freeing OpenGL context");
+ }
+ } finally {
+ X11Util.setX11ErrorHandler(false);
}
}