Skip to content

Commit

Permalink
Fix fullscreen highDPI
Browse files Browse the repository at this point in the history
  • Loading branch information
r58Playz committed Mar 18, 2022
1 parent 3f7c0af commit dc75050
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/java/org/lwjgl/opengl/MacOSXDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ fullscreen, isUndecorated(), resizable,
// when going to fullscreen viewport is set to screen size by Cocoa, ignore this value
skipViewportValue = true;
// if starting in fullscreen then set initial viewport to displaymode size
current_viewport.put(2, mode.getWidth());
current_viewport.put(3, mode.getHeight());
if (current_viewport.get(2) == 0 && current_viewport.get(3) == 0) {
current_viewport.put(2, mode.getWidth());
current_viewport.put(3, mode.getHeight());
}
}

native_mode = nIsNativeMode(peer_handle);
Expand Down Expand Up @@ -328,15 +330,11 @@ public void update() {

DrawableGL drawable = (DrawableGL)Display.getDrawable();
if (should_update) {

// Save the current viewport size as cocoa will automatically
// set the viewport size to the window size on context update
drawable.context.update();
/* This is necessary to make sure the context won't "forget" about the view size */
if (skipViewportValue) skipViewportValue = false;
else glGetInteger(GL_VIEWPORT, current_viewport);

drawable.context.update();

// restore the original viewport size that was set before the update

glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3));
}

Expand Down

0 comments on commit dc75050

Please sign in to comment.