SFML community forums

Help => Graphics => Topic started by: binbinhfr on May 01, 2020, 10:43:20 am

Title: Fullscreen but bad resolution... (edit:duplicate/mirror screen problem)
Post by: binbinhfr on May 01, 2020, 10:43:20 am

Everytime I try to switch into fullscreen mode, at the same max resolution as my windows 10 desktop (1920x1080), the screen blinks and the application switch to an undersample resolution. But if I print on screen the resolution of the mode, it displays 1920x1080...and same thing for the window size.
Here is a screenshot (that seems correct, and that is weird).

BUT it it not what I see on screen : on screen I see the same image but under sampled, with big pixels, something like :

It's weird because it seems that the resolution is recognized... But it is not the case. It's a smaller resolution, and the 1920x1080 window is mapped to this new resolution.
And when I switch back to window 10, during a moment, I see that I was not in 1920x1080 anymore (big icons, big toolbar) before desktop restores its max resolution...
Any idea ?
My GPU is Nvidia GTX1060 and it works correctly in any game in full res, fullscreen.

Here is my code :

#include <SFML/Graphics.hpp>

int main()
    auto& fsmode = sf::VideoMode::getFullscreenModes()[0];

    sf::RenderWindow window(fsmode, "Fullscreen Demo", sf::Style::Fullscreen);

    sf::Text message;
    sf::Font font;
        "resolution:" + std::to_string(fsmode.width) + "x" + std::to_string(fsmode.height) + "\n"
        +"window:" + std::to_string(window.getSize().x) + "x" + std::to_string(window.getSize().y)
    message.setPosition(10, 10);

    sf::CircleShape circleRed(50);

    circleRed.setFillColor(sf::Color(255, 0, 0));
    circleRed.setPosition(100, 100);

    double t = 0.0;

    while (window.isOpen())
        sf::Event event;

        while (window.pollEvent(event))
            switch (event.type)
                case sf::Event::Closed:
                case sf::Event::KeyReleased:
                    if (event.key.code == sf::Keyboard::Key::Escape)

    return 0;
Title: Re: Fullscreen but half bad resolution...
Post by: binbinhfr on May 01, 2020, 12:53:03 pm
Infact, I just found out that this problem is linked to my duplicate/mirror screens setup : I have 2 identical screens (1920x1080) puggled in the GPU card. If I disable the screen mirroring in windows 10, the problem disappear.

It's quite strange because none of the numerous commercial games that I play fullscreen (directX or OpenGL) has that problem. They all works perfectly on dual mirrored screen.

So I wonder what is the difference with SFML implementation ?

Anyone out there using SFML fullscreen and dual mirrored screen ?

PS : looking in this direction, I found an old post about the same problem :
The guy says that the problem was solved by a windows 10 update. That's not my case.
Title: Re: Fullscreen but bad resolution... (edit:duplicate/mirror screen problem)
Post by: Sub on May 03, 2020, 04:08:27 pm
Yeah, I had the same problem.  2 monitor setup (1920x1080 resolution) duplicated on windows in fullscreen mode caused what seemed to be resolution issues.  It's as if the viewport is made smaller but stretched to be fullscreen.  What's weird is that it impacted Windows too, so if I were to press the Windows key to pull up the start menu, the resolution would be off there too.  I saw this in my own code, as well as in commercial SFML games.  I've never experienced a problem like that in non-SFML programs.

Everything worked fine when not fullscreen.  It was also fine when set to any mode other than duplicated screens.  My video card is an Nvidia Geforce 780 TI.   

The issue for me went away with a Windows update, or at least that's what I thought at the time.  I'm not sure what else it could have been that changed.  I haven't experienced the bug since then, which is almost a year now. 

binbin, a possible work around may be to set the mode to borderless, set the window position to 0,0, and the window height and width to that of the desktop resolution.  I'm not sure if this will actually bypass the issue, but it seems likely.
Title: Re: Fullscreen but bad resolution... (edit:duplicate/mirror screen problem)
Post by: binbinhfr on May 03, 2020, 09:02:00 pm
yes indead, the borderless fullscreen window is working. But I still wonder why the true fullscreen has a problem with SFML.