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

Author Topic: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina  (Read 5427 times)

0 Members and 1 Guest are viewing this topic.

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
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
« Last Edit: January 13, 2015, 11:36:23 pm by BlueCobold »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #1 on: January 13, 2015, 06:00:24 pm »
It simply depends on you display settings.
SFML / OS X developer

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #2 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.
« Last Edit: January 13, 2015, 11:38:02 pm by BlueCobold »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #3 on: January 14, 2015, 08:14:43 am »
In Settings > Display, which resolution did you choose? Best for retina or a scaled leve?
SFML / OS X developer

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #4 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.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #5 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.
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #6 on: January 14, 2015, 07:31:19 pm »
Isn't there a confusion between physical and logical pixels here?
Laurent Gomila - SFML developer

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #7 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 ;)
« Last Edit: January 14, 2015, 07:50:00 pm by BlueCobold »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #8 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 might be of importance here as well and it seems like BlueCobold already found the other related thread.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #9 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.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #10 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.
SFML / OS X developer

BlueCobold

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [Mac] sf::VideoMode::getDesktopMode() returns wrong values for retina
« Reply #11 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.