Make sure the swap interval is reset in Display when switching Display modes and toggling fullscreen

This commit is contained in:
Elias Naur 2007-04-28 20:10:21 +00:00
parent 499f838bd6
commit ef37c0e897
1 changed files with 8 additions and 4 deletions

View File

@ -223,7 +223,7 @@ public final class Display {
if (fullscreen) if (fullscreen)
switchDisplayMode(); switchDisplayMode();
createWindow(); createWindow();
makeCurrent(); makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) { } catch (LWJGLException e) {
destroyContext(); destroyContext();
destroyPeerInfo(); destroyPeerInfo();
@ -475,7 +475,7 @@ public final class Display {
display_impl.resetDisplayMode(); display_impl.resetDisplayMode();
} }
createWindow(); createWindow();
makeCurrent(); makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) { } catch (LWJGLException e) {
destroyContext(); destroyContext();
destroyPeerInfo(); destroyPeerInfo();
@ -744,7 +744,7 @@ public final class Display {
try { try {
context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null); context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null);
try { try {
makeCurrent(); makeCurrentAndSetSwapInterval();
initContext(); initContext();
} catch (LWJGLException e) { } catch (LWJGLException e) {
destroyContext(); destroyContext();
@ -765,8 +765,12 @@ public final class Display {
} }
} }
private static void initContext() { private static void makeCurrentAndSetSwapInterval() throws LWJGLException {
makeCurrent();
setSwapInterval(swap_interval); setSwapInterval(swap_interval);
}
private static void initContext() {
// Put the window into orthographic projection mode with 1:1 pixel ratio. // 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. // We haven't used GLU here to do this to avoid an unnecessary dependency.
GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glMatrixMode(GL11.GL_PROJECTION);