From 887c1393269b4a024df0e91cbae5713588e22b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Miko=C5=82ajczyk?= Date: Mon, 11 Feb 2013 22:12:17 +0100 Subject: [PATCH] Qt: Resize GL widget while no game is running --- Qt/EmuThread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Qt/EmuThread.cpp b/Qt/EmuThread.cpp index 69f9d681ca..0246fb9fb4 100644 --- a/Qt/EmuThread.cpp +++ b/Qt/EmuThread.cpp @@ -52,7 +52,10 @@ namespace static void DrawBackground(float alpha) { static float xbase[100] = {0}; static float ybase[100] = {0}; - if (xbase[0] == 0.0f) { + static int old_dp_xres = dp_xres; + // if window was resized, recalculate animation coordinates + if (xbase[0] == 0.0f || dp_xres != old_dp_xres) { + old_dp_xres = dp_xres; GMRng rng; for (int i = 0; i < 100; i++) { xbase[i] = rng.F() * dp_xres; @@ -316,6 +319,7 @@ void EmuThread::run() ReapplyGfxState(); UIShader_Prepare(); + glViewport(0, 0, pixel_xres, pixel_yres); UIBegin(); DrawBackground(alpha);