diff options
Diffstat (limited to 'src/classes/com/sun/opengl/impl/macosx')
-rw-r--r-- | src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java | 6 | ||||
-rw-r--r-- | src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java | 27 |
2 files changed, 10 insertions, 23 deletions
diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java index 0a2d2f613..f4cd14c47 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXGLContext.java @@ -153,7 +153,7 @@ public abstract class MacOSXGLContext extends GLContextImpl created = true; } - if (!CGL.makeCurrentContext(nsContext, drawable.getView())) { + if (!CGL.makeCurrentContext(nsContext)) { throw new GLException("Error making nsContext current"); } @@ -165,14 +165,14 @@ public abstract class MacOSXGLContext extends GLContextImpl } protected void releaseImpl() throws GLException { - if (!CGL.clearCurrentContext(nsContext, drawable.getView())) { + if (!CGL.clearCurrentContext(nsContext)) { throw new GLException("Error freeing OpenGL nsContext"); } } protected void destroyImpl() throws GLException { if (nsContext != 0) { - if (!CGL.deleteContext(nsContext, 0)) { + if (!CGL.deleteContext(nsContext)) { throw new GLException("Unable to delete OpenGL context"); } if (DEBUG) { diff --git a/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java index 9e20dd6dd..dedc5a0ee 100644 --- a/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java +++ b/src/classes/com/sun/opengl/impl/macosx/MacOSXOnscreenGLContext.java @@ -54,13 +54,14 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { } protected int makeCurrentImpl() throws GLException { + int lockRes = 0; try { - int lockRes = drawable.lockSurface(); + lockRes = drawable.lockSurface(); if (lockRes == MacOSXOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { return CONTEXT_NOT_CURRENT; } if (lockRes == MacOSXOnscreenGLDrawable.LOCK_SURFACE_CHANGED) { - super.destroy(); + destroyImpl(); } int ret = super.makeCurrentImpl(); if ((ret == CONTEXT_CURRENT) || @@ -72,32 +73,18 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { // do this updating only upon reshape of this component or reshape or movement // of an ancestor, but this also wasn't sufficient and left garbage on the // screen in some situations. - CGL.updateContext(nsContext, drawable.getView()); - } else { - // View might not have been ready - drawable.unlockSurface(); + CGL.updateContext(nsContext); } return ret; - } catch (RuntimeException e) { - try { + } finally { + if (lockRes != MacOSXOnscreenGLDrawable.LOCK_SURFACE_NOT_READY) { drawable.unlockSurface(); - } catch (Exception e2) { - // do nothing if unlockSurface throws } - throw(e); - } - } - - protected void releaseImpl() throws GLException { - try { - super.releaseImpl(); - } finally { - drawable.unlockSurface(); } } public void swapBuffers() throws GLException { - if (!CGL.flushBuffer(nsContext, drawable.getView())) { + if (!CGL.flushBuffer(nsContext)) { throw new GLException("Error swapping buffers"); } } |