From 455fed40391afe10ce5ffb9146ca325af63b0a49 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 8 Oct 2012 01:55:22 +0200 Subject: Fix GLDrawable.swapBuffer() implementation in AWT/SWT GLCanvas and GLAutoDrawableBase Simply lock drawable and issue drawable.swapBuffers(), no need to make context current. --- .../classes/com/jogamp/opengl/swt/GLCanvas.java | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl') 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 -- cgit v1.2.3