diff options
author | Sven Gothel <[email protected]> | 2012-10-08 01:55:22 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-08 01:55:22 +0200 |
commit | 455fed40391afe10ce5ffb9146ca325af63b0a49 (patch) | |
tree | 925ecae592d59fffe89780100619b455efd9c80e | |
parent | d10dae464ef9309a92eb9b49323fe1db93c3fc9f (diff) |
Fix GLDrawable.swapBuffer() implementation in AWT/SWT GLCanvas and GLAutoDrawableBase
Simply lock drawable and issue drawable.swapBuffers(), no need to make context current.
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java | 26 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 11 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java | 12 |
3 files changed, 13 insertions, 36 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index 24971ff97..73d3cd01e 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -153,24 +153,16 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { }; /* Swaps buffers, assuming the GLContext is current */ - private final Runnable swapBuffersAction = new Runnable() { + private final Runnable swapBuffersOnEDTAction = new Runnable() { @Override public void run() { - drawable.swapBuffers(); - } - }; - - /* Swaps buffers, making the GLContext current first */ - private final Runnable makeCurrentAndSwapBuffersOnEDTAction = new Runnable() { - @Override - public void run() { - final RecursiveLock _lock = lock; - _lock.lock(); - try { - helper.invokeGL(drawable, context, swapBuffersAction, initAction); - } finally { - _lock.unlock(); - } + final RecursiveLock _lock = lock; + _lock.lock(); + try { + drawable.swapBuffers(); + } finally { + _lock.unlock(); + } } }; @@ -627,7 +619,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { @Override public void swapBuffers() throws GLException { - runInGLThread(makeCurrentAndSwapBuffersOnEDTAction); + runInGLThread(swapBuffersOnEDTAction); } @Override diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index a5c15dbda..ed069bf22 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -982,13 +982,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } }; - private final Runnable swapBuffersAction = new Runnable() { - @Override - public void run() { - drawable.swapBuffers(); - } - }; - // Workaround for ATI driver bugs related to multithreading issues // like simultaneous rendering via Animators to canvases that are // being resized on the AWT event dispatch thread @@ -1010,8 +1003,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { final RecursiveLock _lock = lock; _lock.lock(); - try { - helper.invokeGL(drawable, context, swapBuffersAction, initAction); + try { + drawable.swapBuffers(); } finally { _lock.unlock(); } diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index d76272723..42e14366c 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -248,10 +248,8 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { public final void defaultSwapBuffers() throws GLException { final RecursiveLock _lock = getLock(); _lock.lock(); - try { - if(drawable!=null && context != null) { - helper.invokeGL(drawable, context, defaultSwapAction, defaultInitAction); - } + try { + drawable.swapBuffers(); } finally { _lock.unlock(); } @@ -299,12 +297,6 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, FPSCounter { } } - protected final Runnable defaultSwapAction = new Runnable() { - @Override - public final void run() { - drawable.swapBuffers(); - } } ; - @Override public final GLDrawable getDelegatedDrawable() { return drawable; |