diff options
author | Kenneth Russel <[email protected]> | 2005-02-03 23:25:53 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-02-03 23:25:53 +0000 |
commit | 8da5bfa2d72282bfdcd2889a70a93a4072221a1c (patch) | |
tree | 13b9ecce060f1ba23ba83e7f502fa928a4c76848 /src/net/java/games/jogl/impl/x11 | |
parent | dfbee835b5a50b1c6219bd53e15823ea83d73dd6 (diff) |
Fixed Issue 44: Add pbuffer-based GLJPanel implementation
Fixed Issue 61: Make debug variables load from system properties
Added a hardware acceleration path for GLJPanel implemented using the
GLPbuffer interfaces. If instantiation of the pbuffer fails, the
GLJPanel implementation attempts to catch the resulting exception and
fall back on the existing software rendering path.
The new code has been successfully tested on Windows. This checkin
attempts to make the needed changes to the pbuffer implementation on
other platforms, but the GLJPanel continues to use software rendering
until all platforms can be tested.
Additionally, references to static final DEBUG flags have been made
settable via system properties. "jogl.verbose" enables certain
printing statements. "jogl.debug" enables all debugging printing.
"jogl.debug.GLContext" enables the debug printing inside the GLContext
class. The system property names are chosen by convention and are not
enforced.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@209 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/x11')
-rw-r--r-- | src/net/java/games/jogl/impl/x11/X11GLContext.java | 12 | ||||
-rw-r--r-- | src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java | 26 |
2 files changed, 26 insertions, 12 deletions
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java index efcd9a101..1f8023e66 100644 --- a/src/net/java/games/jogl/impl/x11/X11GLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11GLContext.java @@ -187,6 +187,7 @@ public abstract class X11GLContext extends GLContext { } protected void destroyImpl() throws GLException { + lockAWT(); if (context != 0) { GLX.glXDestroyContext(mostRecentDisplay, context); if (DEBUG) { @@ -194,6 +195,7 @@ public abstract class X11GLContext extends GLContext { } context = 0; } + unlockAWT(); } public abstract void swapBuffers() throws GLException; @@ -381,4 +383,14 @@ public abstract class X11GLContext extends GLContext { protected long getContext() { return context; } + + // These synchronization primitives prevent the AWT from making + // requests from the X server asynchronously to this code. + protected void lockAWT() { + getJAWT().Lock(); + } + + protected void unlockAWT() { + getJAWT().Unlock(); + } } diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java index a253b9615..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; @@ -315,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? } @@ -326,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(); - } } |