diff options
author | Sven Gothel <[email protected]> | 2010-11-04 02:37:52 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-04 02:37:52 +0100 |
commit | dc4a31054dc83073ccd5093dfb947dbade13789b (patch) | |
tree | b774ec5caf1da033fcae82b3e4163c7ee171ea39 /src/jogl/classes/com/jogamp | |
parent | 4d56491c3f8e76676e1c860d018bbe991d28ebac (diff) |
JOGL/X11: Decorate glxMakeContextCurrent calls from makeCurrentImpl/releaseImpl with X11 Error Handle
Diffstat (limited to 'src/jogl/classes/com/jogamp')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java | 30 |
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); } } |