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

Author Topic: Resolution issues with fullscreen on duplicated (mirrored) displays on Windows?  (Read 7225 times)

0 Members and 1 Guest are viewing this topic.

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
I looked online to see if this issue was reported anywhere and didn't find anything.  Apologies if I missed it.

I'm running into an issue where the resolution appears to be set incorrectly when using SFML in fullscreen mode with a duplicated monitor setup in Windows.

I'm on Windows 10.  The issue doesn't happen in any version of Linux that I've tried.  I don't know if it also happens in other versions of Windows, I don't have a machine to test anything other than Windows 10.

I'm using two 1920x1080 monitors.  This is the test code

Code: [Select]

#include <SFML/Graphics.hpp>

int main(int argc, char* argv[])
{
//sf::RenderWindow window(sf::VideoMode(1920, 1080), "SFML window");
sf::RenderWindow window(sf::VideoMode::getFullscreenModes()[0], "SFML window", sf::Style::Fullscreen);

sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);

while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}

window.clear();
window.draw(shape);
window.display();
}

return 0;
}


If I log sf::VideoMode::getFullscreenModes()[0].width and sf::VideoMode::getFullscreenModes()[0].height, they're reporting 1920 and 1080, which are the correct values.

It was hard for me to take a screenshot showing the issue off, as when I take a screenshot, my monitor goes blank for a moment and some of the issues go away momentarily until after the screenshot.  For instance, the mouse cursor is much larger than it should be ordinarily, and the circle is a lot more jaggy than the image shows.

Still though, I hope the following images show what I'm talking about.  I'm alt tabbing because it shows the issue more readily.

This is what the program / my desktop looks like when running the above code in windowed mode (so the first window line uncommented with the second one commented).

This is what the program / my desktop looks like when running the above code in fullscreen mode.  Although, again, it's worse than the image makes it out to be. 
« Last Edit: June 06, 2018, 03:59:42 am by Sub »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
It's hard to see what the issue really is. To me it sounds like graphics card settings which may only apply for full screen applications and/or your GPU failing to properly mirror a screen.

Is this on your main monitor?

Also that behavior for your screenshot sounds weird, maybe try once without having Greenshot running.

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/

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
It could very well be a graphics card setting or driver issue.  I have a Geforce GTX 780 TI using driver version 391.35.

I've only encountered this problem with SFML programs though.  I'm also not sure what graphics setting could cause this behavior.  When I alt tab with the issue active and look at the nvidia control panel (as well as windows display settings), it shows the resolution still at 1920x1080, despite that clearly no longer being the case.

It's occurring on both monitors, they're a perfect mirror of each other.

Here's a screenshot from another SFML game where you can see the resolution is out of whack with the text.

https://i.imgur.com/9y8obT4.jpg

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
I think this one is more clear.

https://i.imgur.com/uYSf2LV.png

https://i.imgur.com/IOIbjSl.png

Same map at the same camera position, but one is fullscreen and one is borderless.

edit:  Just updated my graphics driver to the latest (398.11).  Unfortunately the issue is still happening.
« Last Edit: June 06, 2018, 09:36:00 am by Sub »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Ah so it's more or less just zoomed in.

Maybe the monitor mirroring has issues with switching to the correct fullscreen mode.
Not sure if it's possible, but could you check whether both monitors will switch to the correct resolution?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
Quote
Ah so it's more or less just zoomed in.

Yeah.  It looks to me as if the viewport is smaller than the window size, and it's being stretched to fit.  Except it's also affecting the underlying OS.

Anyways, both monitors do indeed switch to the correct resolution.  To be clear, this is what I did
1.  Set windows to only show on monitor 1 and then ran an SFML app fullscreen.  It behaved correctly.
2.  Set windows to only show on monitor 2 and then ran an SFML app fullscreen.  It behaved correctly.
3.  I decided to try out switching the monitor ordering, so I unplugged monitor 1 and monitor 2 and switched the ports that their cables were plugged into.  I then set windows to mirror the displays again.  The issue still happens.

I should probably mention at this point that one monitor is actually a TV, and is significantly larger than the other one.  I'm sure this is a stupid question but is the code that fullscreens it at all DPI aware?  Could that somehow be screwing this up?

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
I'm going to chalk this one up to a bug in Windows.  I just downloaded and installed the April 2018 update and this is now fixed. 

Thanks for the help eXpl0it3r. 

gugglegum

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Three years later... I've faced with the same issue and found this topic by search. My monitor has 1920x1080 resolution. But my application with SFML 2.5.1 in fullscreen mode with the same resolution looks weird. It looks like real in-game resolution is 1280x720 or something similar and it's upscaled then to 1920x1080 without any antialiasing. Although internal screen coordinates in SFML are still 1920x1080. This means if I draw a point at position (1919, 1079) it will be drawn in right bottom corner.

At first I also thought this to be related to a recent Windows 10 update. Because already compiled program that was working fine earlier now runs in this upscaled 720p mode even after Windows 10 reboot. And recently I installed some Windows update.

But when I found this topic I remembered that I also recently connected my TV to my PC via HDMI cable. TV is configured as second display with the same resoultion as main monitor (1920x1080) in duplicated mode.

Disconnecting HDMI cable from TV solves the problem. Connecting again brings the problem back. Reproducibility is 100%. It's no matter is TV turned on or turned off.

I think this is SFML 2.5.1 bug because previously I lived with HDMI cable connected to TV for many years, played different modern games almost every day and no such problem in any other applications.

The real screen resolution is still 1920x1080 bc otherwise I would see blurred pixels. While my fullscreen app is running, I can press Win-key or Alt-TAB and switch to another application. Windows interface and apps are not blurred but they scaled by ~150%. Here is a screenshot below that shows the problem after pressing Alt-TAB. All buttons on Windows taskbar are bigger. But I don't use scaling in Display settings.

On the black background on my screenshot in 1st attachment you can see my fullscreen game. At the right bottom corner you can see something like a white tank and text labels at the top of screen with coordinates. The tank and text labels looks blurred on my screenshot. But in real they are not. Screenshot in Windows adds smoothing. You can see how it looks in real on the photo in 2nd attachment.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Note that TVs often have some overscan, so it might well be that you don't see all pixels shown. Usually you can play around with settings to get this aligned.

SFML currently doesn't really handle DPI scaling, nor doesn't it provide an API to detect the scaling.
You may want to have an option and manually scale your sf::View to match the general UI scaling.
« Last Edit: May 09, 2024, 10:15:40 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gugglegum

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Note that TVs often have some overscan, so it might well be that you don't see all pixels shown. Usually you can play around with settings to get this aligned.
Overscan on TV can be easily turned off by menu settings. And it's turned off. I always see all pixels. I don't think it's related. Because the problem appears even if TV is switched off.

SFML currently doesn't really handle DPI scaling, not doesn't it provide an API to detect the scaling.
You may want to have an option and manually scale your sf::View to match the general UI scaling.
It's not related to DPI scalling because it's set to 100% in Display Settings of Windows. It's just a bug.

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
Yeah unfortunately this is definitely still a bug. I'm on the latest version of windows 10 and using completely different hardware from when I first reported the issue and it still happens. I'm going to report it on Github when I get a chance.