diff options
author | Kenneth Russel <[email protected]> | 2005-02-26 01:41:28 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-02-26 01:41:28 +0000 |
commit | b41b720c4366d4e2cdc1ba146123b87da966d724 (patch) | |
tree | 6c6c8196e9ac0ef57f068f394c1720ec034639c2 /src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java | |
parent | 2bb02ad536c5404f008ff71c6d4ca013abaff683 (diff) |
Merged with current JOGL trunk (tag JOGL_1_1_PRE_B10)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@245 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java')
-rw-r--r-- | src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java index 5ab976870..5b6df1843 100644 --- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java @@ -43,7 +43,7 @@ import net.java.games.jogl.*; import net.java.games.jogl.impl.*; public class X11PbufferGLContext extends X11GLContext { - private static final boolean DEBUG = false; + private static final boolean DEBUG = Debug.debug("X11PbufferGLContext"); private int initWidth; private int initHeight; @@ -209,7 +209,7 @@ public class X11PbufferGLContext extends X11GLContext { iattributes[niattribs++] = 0; - int tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes); + long tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes); if (tmpBuffer == 0) { // FIXME: query X error code for detail error message throw new GLException("pbuffer creation error: glXCreatePbuffer() failed"); @@ -251,10 +251,7 @@ public class X11PbufferGLContext extends X11GLContext { created = true; } - // FIXME: this cast to int would be wrong on 64-bit platforms - // where the argument type to glXMakeCurrent would change (should - // probably make GLXDrawable, and maybe XID, Opaque as long) - if (!GLX.glXMakeContextCurrent(display, (int) buffer, (int) buffer, context)) { + if (!GLX.glXMakeContextCurrent(display, buffer, buffer, context)) { throw new GLException("Error making context current"); } @@ -318,6 +315,19 @@ public class X11PbufferGLContext extends X11GLContext { } } + protected void destroyImpl() throws GLException { + lockAWT(); + try { + if (context != 0) { + super.destroyImpl(); + GLX.glXDestroyPbuffer(display, buffer); + buffer = 0; + } + } finally { + unlockAWT(); + } + } + public void swapBuffers() throws GLException { // FIXME: do we need to do anything if the pbuffer is double-buffered? } @@ -329,15 +339,4 @@ public class X11PbufferGLContext extends X11GLContext { } return tmp[0]; } - - // These synchronization primitives, which prevent the AWT from - // making requests from the X server asynchronously to this code, - // are required for pbuffers to work properly on X11. - private void lockAWT() { - getJAWT().Lock(); - } - - private void unlockAWT() { - getJAWT().Unlock(); - } } |