diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/com/sun/javafx/newt/GLWindow.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java index de2205773..e46416a1d 100644 --- a/src/classes/com/sun/javafx/newt/GLWindow.java +++ b/src/classes/com/sun/javafx/newt/GLWindow.java @@ -354,7 +354,12 @@ public class GLWindow extends Window implements GLAutoDrawable { } public void swapBuffers() { - drawable.swapBuffers(); + if (context != null && context != GLContext.getCurrent()) { + // Assume we should try to make the context current before swapping the buffers + helper.invokeGL(drawable, context, swapBuffersAction, initAction); + } else { + drawable.swapBuffers(); + } } class InitAction implements Runnable { @@ -380,6 +385,14 @@ public class GLWindow extends Window implements GLAutoDrawable { private DisplayAction displayAction = new DisplayAction(); + class SwapBuffersAction implements Runnable { + public void run() { + drawable.swapBuffers(); + } + } + + private SwapBuffersAction swapBuffersAction = new SwapBuffersAction(); + //---------------------------------------------------------------------- // GLDrawable methods that are not really needed // |