From 250e4ed622d108c1b687dbc8c25b1c7b721b2f72 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 17 Mar 2019 14:42:14 +0200 Subject: [PATCH] - do not use OpenGL function to clear screen in Cocoa backend In fullscreen mode there is a white flash (of the default background color) on startup To overcome this an explicit glClear() with flush buffers was used In order to make video mode switch more generic, any backend specific functionality should be avoided here --- src/posix/cocoa/i_video.mm | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 1b6b5815f..b1334778f 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -52,10 +52,7 @@ #include "version.h" #include "doomerrors.h" -#include "gl/renderer/gl_renderer.h" #include "gl/system/gl_framebuffer.h" -#include "gl/textures/gl_samplers.h" - #include "vulkan/system/vk_framebuffer.h" @@ -182,6 +179,12 @@ namespace @implementation OpenGLCocoaView +- (void)drawRect:(NSRect)dirtyRect +{ + [NSColor.blackColor setFill]; + NSRectFill(dirtyRect); +} + - (void)resetCursorRects { [super resetCursorRects]; @@ -327,9 +330,6 @@ void SetupOpenGLView(CocoaWindow* window) [[glView openGLContext] makeCurrentContext]; [window setContentView:glView]; - - // To be able to use OpenGL functions in SetMode() - ogl_LoadFunctions(); } } // unnamed namespace @@ -658,14 +658,6 @@ 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])