mac: Fix when compiled with recent SDK and when running on high DPI display, that the game would only render in 1/4 of the window. Fixes #888

This commit is contained in:
UnknownShadow200 2022-10-05 23:02:52 +11:00
parent 9b5a3cff70
commit c21af3c4d5

View File

@ -287,9 +287,16 @@ void Gfx_EndFrame(void) {
} }
void Gfx_OnWindowResize(void) { void Gfx_OnWindowResize(void) {
GLContext_Update();
/* In case GLContext_Update changes window bounds */
/* TODO: Eliminate this nasty hack.. */ /* TODO: Eliminate this nasty hack.. */
Game_UpdateDimensions(); Game_UpdateDimensions();
glViewport(0, 0, Game.Width, Game.Height); glViewport(0, 0, Game.Width, Game.Height);
/* With cocoa backend, in some cases [NSOpenGLContext update] will actually */
/* call glViewport with the size of the window framebuffer */
/* https://github.com/glfw/glfw/issues/80 */
/* Normally this doesn't matter, but it does when game is compiled against recent */
/* macOS SDK *and* the display is a high DPI display - where glViewport(width, height) */
/* above would otherwise result in game rendering to only 1/4 of the screen */
/* https://github.com/UnknownShadow200/ClassiCube/issues/888 */
GLContext_Update();
} }