From 53bf598aee63d6e525c5f0c8423c2bf426d77c74 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 3 Nov 2018 13:09:30 +0200 Subject: [PATCH] - restored screen clear in Cocoa backend when setting video mode This still doesn't work well in windowed mode In fullscreen the effect is quite noticeable thought --- src/posix/cocoa/i_video.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 8cc8fe0183..cb54f76c92 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -355,6 +355,9 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen) assert(frameBuffer == nullptr); frameBuffer = this; + // To be able to use OpenGL functions in SetMode() + ogl_LoadFunctions(); + FConsoleWindow::GetInstance().Show(false); } @@ -527,6 +530,14 @@ void SystemGLFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI) SetWindowedMode(); } + const NSSize viewSize = I_GetContentViewSize(m_window); + + glViewport(0, 0, static_cast(viewSize.width), static_cast(viewSize.height)); + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + [[NSOpenGLContext currentContext] flushBuffer]; + [m_window updateTitle]; if (![m_window isKeyWindow])