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)
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);