raysan5/raylib

[rcore] The content can't be rendered correctly in fullscreen mode.

archewashi opened this issue · 3 comments

Issue description

Upon calling ToggleFullScreen(), the scale of content doesn't seem correct.
After calling ToggleFullScreen(), other applications with maximized window would be resized to different resolution.

I found that in rcore_desktop.c, the width and height of the parameter in glfwSetWindowMonitor() are as same as the original window screen. This will cause that glfw make the monitor switch to the video mode closest to it, that is, if the window size is (800, 600) and full resolution is (1920, 1080), it will change the video mode to which is closest to (800,600) rather than (1920, 1080).

else
{
CORE.Window.fullscreen = true;
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
glfwSetWindowMonitor(platform.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
}

@raysan5 Is this an error? I don't see something like this in rcore_desktop_sdl.c.

Environment

Platform backend: DESKTOP (GLFW)
OS: Windows 11 (msys2)

Code Example

example/core_window_flag.c

else
{
    CORE.Window.fullscreen = true;
    CORE.Window.flags |= FLAG_FULLSCREEN_MODE;

    const GLFWvidmode *mode = glfwGetVideoMode(monitor);
    glfwSetWindowMonitor(platform.handle, monitor, 0, 0, mode->width, mode->height, GLFW_DONT_CARE);
}

Use the width and height of mode of the monitor can solve it.

Is this an error? I don't see something like this in rcore_desktop_sdl.c.

@archewashi This is not an error but the expected behaviour. When an application requests full-screen exclusive mode, the monitor resolution should match (as close as possible) the application resolution.

If that's not the desired behaviour, then borderless-fullscreen-window should be requested with ToggleBorderlessWindowed() that scales application to monitor resolution.

Oh, I see. Thank you, @raysan5.