Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fullscreen but bad resolution... (edit:duplicate/mirror screen problem)  (Read 3843 times)

0 Members and 1 Guest are viewing this topic.

binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
Hi,

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 :

Quote
#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;
    font.loadFromFile("arial.ttf");
    message.setFont(font);
    message.setString(
        "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.setCharacterSize(100);
    message.setFillColor(sf::Color::White);
    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:
                    window.close();
                    break;
                case sf::Event::KeyReleased:
                    if (event.key.code == sf::Keyboard::Key::Escape)
                        window.close();
                    break;
            }
        }
       
        window.clear();
        window.draw(circleRed);
        window.draw(message);
        window.display();
    }

    return 0;
}
« Last Edit: May 01, 2020, 04:43:31 pm by binbinhfr »

binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Fullscreen but half bad resolution...
« Reply #1 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 :
https://en.sfml-dev.org/forums/index.php?topic=24119.msg163541#msg163541
The guy says that the problem was solved by a windows 10 update. That's not my case.

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
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.
« Last Edit: May 03, 2020, 04:10:32 pm by Sub »

binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
yes indead, the borderless fullscreen window is working. But I still wonder why the true fullscreen has a problem with SFML.

 

anything