diff --git a/src/core/renderer_gl/renderer_gl.cpp b/src/core/renderer_gl/renderer_gl.cpp index 2d54e586..ec2a7f0b 100644 --- a/src/core/renderer_gl/renderer_gl.cpp +++ b/src/core/renderer_gl/renderer_gl.cpp @@ -529,6 +529,10 @@ void RendererGL::drawVertices(PICA::PrimType primType, std::span v } void RendererGL::display() { + + static u32 lastWidth = outputWindowWidth; + static u32 lastHeight = outputWindowHeight; + gl.disableScissor(); gl.disableBlend(); gl.disableDepth(); @@ -567,9 +571,18 @@ void RendererGL::display() { } if constexpr (!Helpers::isHydraCore()) { - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); screenFramebuffer.bind(OpenGL::ReadFramebuffer); - glBlitFramebuffer(0, 0, 400, 480, 0, 0, outputWindowWidth, outputWindowHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); + + const u32 newX0 = (outputWindowWidth - 400) / 2; + const u32 newY0 = (outputWindowHeight - 480) / 2; + if(lastWidth != outputWindowWidth || lastHeight != outputWindowHeight) { + lastHeight = outputWindowHeight; + lastWidth = outputWindowWidth; + glClear(GL_COLOR_BUFFER_BIT); + } + + glBlitFramebuffer(0, 0, 400, 480, newX0, newY0, newX0 + 400, newY0 + 480, GL_COLOR_BUFFER_BIT, GL_LINEAR); } } diff --git a/src/panda_sdl/frontend_sdl.cpp b/src/panda_sdl/frontend_sdl.cpp index 2d60d2fa..93f0ad93 100644 --- a/src/panda_sdl/frontend_sdl.cpp +++ b/src/panda_sdl/frontend_sdl.cpp @@ -117,6 +117,8 @@ FrontendSDL::FrontendSDL() : keyboardMappings(InputMappings::defaultKeyboardMapp } #endif + SDL_SetWindowMinimumSize(window, 400, 480); + emu.initGraphicsContext(window); }