SFML community forums

Help => Window => Topic started by: BlueCobold on January 13, 2015, 05:51:43 pm

Title: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: BlueCobold on January 13, 2015, 05:51:43 pm
Hi.

I'm using SFML master version and have set HighResolutionCapable in my info.plist to true.
sf::VideoMode::getFullscreenModes() returns me all available modes including 2880x1800.
sf::VideoMode::getDesktopMode() however returns only 1440x900 instead of the expected 2880x1800.

Greetings
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: Hiura on January 13, 2015, 06:00:24 pm
It simply depends on you display settings.
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: BlueCobold on January 13, 2015, 11:18:26 pm
Excuse me? How can the list of *all* resolutions return me 2880x1800 while the getDesktopMode-function returns only 1440x900? That's just a bug, a missing scaling. My desktop resolution is 2880x1800 and with HighResolution-support, the function should return 2880x1800, not 1440x900. SFML also does allow me to create a window of 2880x1800 which is the size of my desktop.
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: Hiura on January 14, 2015, 08:14:43 am
In Settings > Display, which resolution did you choose? Best for retina or a scaled leve?
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: BlueCobold on January 14, 2015, 06:39:39 pm
Best for retina.
But what does a system setting have to do with what SFML returns? If SFML reports the highest possible resolution to be 2880x1800, why would it report the desktop to have a lower resolution than that while the user currently *is* using the highest possible desktop resolution? That sounds very implausible.
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: Hiura on January 14, 2015, 06:44:32 pm
Best for retina is not full 2880x1800... Change the settings to the different level of scale and run

#include <SFML/Graphics.hpp>

#include <iostream>

std::ostream& operator<<(std::ostream& out, sf::VideoMode vm) {
    return out << "{" << vm.width << ", " << vm.height << "}";
}

int main(int, char const**)
{
    std::cout << "Desktop: " << sf::VideoMode::getDesktopMode() << std::endl;
    return 0;
}
 

and see what happens. You'll see that SFML reflect the user's settings pretty well.
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: Laurent on January 14, 2015, 07:31:19 pm
Isn't there a confusion between physical and logical pixels here?
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: BlueCobold on January 14, 2015, 07:47:10 pm
Yea, if I change the scale, it changes in SFML too. But thats still not logical. I expect SFML to return me all physical resolutions - ie the number of actual pixels I can address separately. That includes the desktop resolution. And that one isn't changing at all.
In other words:
sf::VideoMode::getFullscreenModes() returns physical pixel resolutions - independent of screen scaling
sf::VideoMode::getDesktopMode() returns logical point resolution - dependent on screen scaling
This is inconsistent. As a developer, requesting the desktop resolution and creating a window of that size should result in a window having the desktop size. But that isn't happening ;)
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: eXpl0it3r on January 16, 2015, 10:23:40 am
As thomas9459 has said before SFML needs to do more to fully support high DPI screens. As such this feature request thread (http://en.sfml-dev.org/forums/index.php?topic=17092.0) might be of importance here as well and it seems like BlueCobold already found the other related thread (http://en.sfml-dev.org/forums/index.php?topic=17050.0).
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: BlueCobold on January 16, 2015, 11:12:00 am
Yea, but what's the consent now? This issue won't be touched until SFML will have high DPI support in general? Because if so, I will have to make a temporary fix on that myself.
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: Hiura on January 21, 2015, 02:42:36 pm
We definitely need improvement regarding the monitor capabilities/API, but here it's a bug: the size returned by sf::VideoMode::getDesktopMode() don't take the scaling factor into account but sf::Window::create does. Sorry for the earlier misleading answers.

The behaviour should be consistent when `High Resolution Capable` is set to `NO` in the app's plist file.
Title: Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
Post by: BlueCobold on January 21, 2015, 02:45:15 pm
Yes, it is OK for non-retina devices or when having HighResolutionCapable set to NO. When setting it to YES on retina devices, the problem occurs.