From ef37c0e8975f95b0d87ae2e38c23c5d264626a2c Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 28 Apr 2007 20:10:21 +0000 Subject: [PATCH] Make sure the swap interval is reset in Display when switching Display modes and toggling fullscreen --- src/java/org/lwjgl/opengl/Display.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index f1fc8cb4..57334c56 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -223,7 +223,7 @@ public final class Display { if (fullscreen) switchDisplayMode(); createWindow(); - makeCurrent(); + makeCurrentAndSetSwapInterval(); } catch (LWJGLException e) { destroyContext(); destroyPeerInfo(); @@ -475,7 +475,7 @@ public final class Display { display_impl.resetDisplayMode(); } createWindow(); - makeCurrent(); + makeCurrentAndSetSwapInterval(); } catch (LWJGLException e) { destroyContext(); destroyPeerInfo(); @@ -744,7 +744,7 @@ public final class Display { try { context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null); try { - makeCurrent(); + makeCurrentAndSetSwapInterval(); initContext(); } catch (LWJGLException e) { destroyContext(); @@ -765,8 +765,12 @@ public final class Display { } } - private static void initContext() { + private static void makeCurrentAndSetSwapInterval() throws LWJGLException { + makeCurrent(); setSwapInterval(swap_interval); + } + + private static void initContext() { // Put the window into orthographic projection mode with 1:1 pixel ratio. // We haven't used GLU here to do this to avoid an unnecessary dependency. GL11.glMatrixMode(GL11.GL_PROJECTION);