From 967720b06e366cea635090ad0395758f91957d1b Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Thu, 18 Aug 2005 05:44:58 +0000 Subject: Fixed bug in X11OnscreenGLDrawable.swapBuffers() when surface was not locked git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@349 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../games/jogl/impl/x11/X11OnscreenGLDrawable.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/net/java/games') diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java index 0b66c51a7..a8308cf13 100644 --- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java +++ b/src/net/java/games/jogl/impl/x11/X11OnscreenGLDrawable.java @@ -92,8 +92,25 @@ public class X11OnscreenGLDrawable extends X11GLDrawable { public void swapBuffers() throws GLException { lockAWT(); - GLX.glXSwapBuffers(display, drawable); + try { + boolean didLock = false; + + if (drawable == 0) { + if (lockSurface() == LOCK_SURFACE_NOT_READY) { + return; + } + + didLock = true; + } + + GLX.glXSwapBuffers(display, drawable); + + if (didLock) { + unlockSurface(); + } + } finally { unlockAWT(); + } } public int lockSurface() throws GLException { -- cgit v1.2.3