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 682 times)

0 Members and 1 Guest are viewing this topic.

Sub

  • Full Member
  • ***
  • Posts: 143
    • 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: 9221
    • 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
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Sub

  • Full Member
  • ***
  • Posts: 143
    • 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: 143
    • 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: 9221
    • 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
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Sub

  • Full Member
  • ***
  • Posts: 143
    • 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: 143
    • 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. 

 

anything