Skip to content

Commit 23989d2

Browse files
committed
Fix the viewport getting squished into the bottom left corner on High-DPI
1 parent 12f0c5f commit 23989d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libs/s25main/drivers/VideoDriverWrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,19 @@ void VideoDriverWrapper::RenewViewport()
305305
if(!videodriver->IsOpenGL() || !renderer_)
306306
return;
307307

308-
const Extent renderSize = videodriver->GetRenderSize();
308+
const Extent renderSize = getGuiScale().viewToScreen<Extent>(videodriver->GetRenderSize());
309309
const VideoMode windowSize = videodriver->GetWindowSize();
310310

311311
// Set the viewport and scissor area to the entire window
312-
glViewport(0, 0, windowSize.width, windowSize.height);
313-
glScissor(0, 0, windowSize.width, windowSize.height);
312+
glViewport(0, 0, renderSize.x, renderSize.y);
313+
glScissor(0, 0, renderSize.x, renderSize.y);
314314

315315
// Orthogonale Matrix erstellen
316316
glMatrixMode(GL_PROJECTION);
317317
glLoadIdentity();
318318

319319
// 0,0 should be top left corner
320-
glOrtho(0, renderSize.x, renderSize.y, 0, -100, 100);
320+
glOrtho(0, windowSize.width, windowSize.height, 0, -100, 100);
321321

322322
glMatrixMode(GL_MODELVIEW);
323323
glLoadIdentity();

0 commit comments

Comments
 (0)