]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
VID_InitModeGL(): fix clear to black of new window
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 3 Oct 2023 08:32:04 +0000 (18:32 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 28 Oct 2023 08:21:22 +0000 (18:21 +1000)
The window was left with whatever was already in the framebuffer.
Also we can perform the clear a bit earlier.

Changes initial state of vid_activewindow to match the logic that sets
it during normal frames.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
vid_sdl.c

index 6f71d29b5104a0da1d869ad6ee44b4f7ff49c665..7cee4def134bf482dda2adbe4e1184bf02721a74 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -1619,6 +1619,16 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        SDL_GL_SetSwapInterval(bound(-1, vid_vsync.integer, 1));
        vid_usingvsync = (vid_vsync.integer != 0);
 
+       vid_hidden = false;
+       vid_activewindow = true;
+       vid_hasfocus = true;
+       vid_usingmouse = false;
+       vid_usinghidecursor = false;
+
+       // clear to black (loading plaque will be seen over this)
+       GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 0);
+       VID_Finish(); // checks vid_hidden
+
        GL_Setup();
 
        // VorteX: set other info
@@ -1628,15 +1638,6 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        Cvar_SetQuick(&gl_info_platform, "SDL");
        Cvar_SetQuick(&gl_info_driver, drivername ? drivername : "");
 
-       // clear to black (loading plaque will be seen over this)
-       GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 0);
-
-       vid_hidden = false;
-       vid_activewindow = false;
-       vid_hasfocus = true;
-       vid_usingmouse = false;
-       vid_usinghidecursor = false;
-               
        return true;
 }