From 57635274d24d7ff83d1994d15ac1db95ec499353 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 9 Sep 2005 10:27:13 +0000 Subject: [PATCH] Mac OS X: Fetch the current viewport dimensions instead of assuming them equal to the current window size --- src/java/org/lwjgl/opengl/MacOSXDisplay.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/java/org/lwjgl/opengl/MacOSXDisplay.java b/src/java/org/lwjgl/opengl/MacOSXDisplay.java index 5ba71dba..f339420a 100644 --- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java +++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java @@ -62,6 +62,7 @@ import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; +import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.input.Keyboard; @@ -217,6 +218,7 @@ final class MacOSXDisplay implements DisplayImplementation { return new MacOSXDisplayPeerInfo(pixel_format); } + private final static IntBuffer current_viewport = BufferUtils.createIntBuffer(16); public void update() { boolean should_update = frame.getCanvas().syncShouldUpdateContext(); /* @@ -250,7 +252,8 @@ final class MacOSXDisplay implements DisplayImplementation { if (should_update) { Display.getContext().update(); /* This is necessary to make sure the context won't "forget" about the view size */ - GL11.glViewport(0, 0, frame.getCanvas().syncGetWidth(), frame.getCanvas().syncGetHeight()); + GL11.glGetInteger(GL11.GL_VIEWPORT, current_viewport); + GL11.glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3)); } if (frame.syncShouldWarpCursor()) { warpCursor();