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

Author Topic: Fullscreen at non-screen resolutions causes desktop to show.  (Read 2188 times)

0 Members and 1 Guest are viewing this topic.

FreNeS1

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Fullscreen at non-screen resolutions causes desktop to show.
« on: October 18, 2016, 05:55:59 pm »
Hi, I started a project a while now, and I just now realized a problem with the fullscreen.

When I ask the window to display at fullscreen with the videomode set as the screen resolution, it shows correctly, but if I ask the window to display at fullscreen with a videomode lower than the screen resolution (even being valid) It shows, displays and updates correctly, but part of the desktop is shown. I can even interact with the desktop while the program is fullscreen.

Here's an image of that: https://s9.postimg.org/9lg8onzqn/Error.png

I don't think the code has anything to do with it but here goes anyway:

m_Window = new sf::RenderWindow();
                if (m_Options.getFullscreen())
                {
                        sf::VideoMode vm = sf::VideoMode(m_Options.getWidth(), m_Options.getHeight());
                        if (vm.isValid())
                                m_Window->create(vm, title, sf::Style::Fullscreen);
                        else
                        {
                                utils::FileLogger::Log(utils::FileLogger::LogType::LOG_WARNING, "Window mode not suported, starting windowed");
                                m_Window->create(vm, title, sf::Style::Close);
                        }
                }
                else
                        m_Window->create(sf::VideoMode(m_Options.getWidth(), m_Options.getHeight()), title, sf::Style::Close);

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10850
    • View Profile
    • development blog
    • Email
AW: Fullscreen at non-screen resolutions causes desktop to show.
« Reply #1 on: October 18, 2016, 07:30:02 pm »
What version of SFML are you using? What's your GPU? What's your GPU driver version?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FreNeS1

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Fullscreen at non-screen resolutions causes desktop to show.
« Reply #2 on: October 18, 2016, 07:57:45 pm »
I had SFML 2.3.2. But now I have updated it to 2.4.0 and the issue is still there.

NVIDIA Geforce 750M - Lattest drivers (373.06)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10850
    • View Profile
    • development blog
    • Email
AW: Fullscreen at non-screen resolutions causes desktop to show.
« Reply #3 on: October 18, 2016, 09:30:30 pm »
Are you certain that you are using a valid fullscreen mode? Just to make sure, can you check the actual value used and see if that option is available when you try to change it in the Windows display options?
It's probably also good if you use the getFullscreenModes() function: http://www.sfml-dev.org/documentation/2.4.0/classsf_1_1VideoMode.php#a6815b9b3b35767d5b4563fbed4bfc67b

Do you have a high DPI screen? Or have some special window handling/scaling activated?

If you turn down the fullscreen resolution in some other Open GL game do you see the same effert happening?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FreNeS1

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Fullscreen at non-screen resolutions causes desktop to show.
« Reply #4 on: October 18, 2016, 10:15:03 pm »
Ok, this has cost me a bit of a headacke, but I finally figured it out.

Windows 10 has a special scaling feature that seems to affect the window. In Config -> System -> Display (first option) there's a scaling of aplications, text and other elements. This aplies to everything on screen, but when the game is launched, it seems to default it at 100%.

When you change it manualy to 125% (my default) after launching the game it "fixes" the fullscreen. When exiting the game after manualy changing it, it goes up to 150%.

When asking the window to display at desktop resolution, my guess is that it leaves the scaling alone because it doesn't have to change anything.

If there could be some way to access the scaling factor previous to creating the screen, you could manualy scale the window, but I have no idea how to do that. Honestly I have no idea how to fix this.

EDIT1:
Right now I'm "solving" the problem by making fullscreen mode only avaliable to the user as (sf::VideoMode::getDesktopMode()), but I'd prefer if there was a way of making fullscreen reliable in windows 10.
« Last Edit: October 19, 2016, 04:47:02 pm by FreNeS1 »