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

Author Topic: Window Size On Retina Macbook Pro  (Read 7148 times)

0 Members and 1 Guest are viewing this topic.

filchermcurr

  • Newbie
  • *
  • Posts: 1
    • View Profile
Window Size On Retina Macbook Pro
« on: August 23, 2015, 03:09:58 am »
... or any high DPI displays in general, I guess!

I hope this isn't too silly of a newbie question! I've noticed that SFML seems to handle scaled resolutions differently than GLFW. When GLFW creates an 800x600 window, it looks appropriately sized when using a scaled resolution in OS X ('looks like 1440x900' for those curious of which scaling setting). When SFML creates an 800x600 window, though, it's tiny. It looks like SFML is basing the size of the window on the actual monitor resolution rather than the scaled resolution. Here's a screenshot of both running at the time time for comparison:

http://imgur.com/TvZ4m2F

Are there any options to make SFML behave more like GLFW on a high DPI display?

Thanks!



SFML Version: 2.3.1 from 94dd1d7
Minimal GLFW source: http://pastebin.com/F7L35Sap
Minimal SFML source: http://pastebin.com/Wurcxeig

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Window Size On Retina Macbook Pro
« Reply #1 on: August 23, 2015, 09:47:15 am »
Yes, you just need to add NSHighResolutionCapable to your application's plist file. But if you use the SFML template for Xcode it's done for you.
SFML / OS X developer

emlai

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window Size On Retina Macbook Pro
« Reply #2 on: April 10, 2016, 08:09:34 pm »
you just need to add NSHighResolutionCapable to your application's plist file

What if I'm distributing a plain executable file, not an .app bundle with a plist?

Right now SFML is forcing the following situation: The high-DPI users of my program have to explicitly go into the preferences and specify that they want their window to be scaled 2x to get a normal-sized window. (Since there's no way to detect high-DPI vs non-high-DPI programmatically.)

SDL2 doesn't have this problem. Instead it just works: Windows have the same virtual size on high-DPI and non-high-DPI displays, with no need to specify NSHighResolutionCapable anywhere. In addition, it's possible to detect high-DPI vs non-high-DPI programmatically.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window Size On Retina Macbook Pro
« Reply #3 on: April 10, 2016, 10:33:53 pm »
I'm not trying to sound rude, just want to point out that we're neither SDL nor GFLW. Every library has their quirks and things that work and doesn't work, so there's really no use for "but library X has feature Y!!". ;)

We're always open to suggestions and even better contributions. Check out the feature request forum and the contribution guidelines.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Window Size On Retina Macbook Pro
« Reply #4 on: April 11, 2016, 11:26:50 am »
What if I'm distributing a plain executable file, not an .app bundle with a plist?

This is not the typical thing to do on OS X, actually.

Quote
there's no way to detect high-DPI vs non-high-DPI programmatically
Quote
it's possible to detect high-DPI vs non-high-DPI programmatically.

I'm confused.  ::)

Anyway, even if it is possible to do it, the advantage of application bundles on OS X over regular binary files is so huge that I don't really see the point of adding such mechanism, especially since it would actually force every application to use high res settings.
SFML / OS X developer

emlai

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window Size On Retina Macbook Pro
« Reply #5 on: July 20, 2016, 06:38:15 pm »
Yes, you just need to add NSHighResolutionCapable to your application's plist file.

I finally tried this out; made an .app bundle with NSHighResolutionCapable set to true in its Info.plist. However, the created window is still the same size as it was before this: half of the size I requested. Is this a bug?
« Last Edit: July 21, 2016, 12:50:25 pm by emlai »

JoelHoover

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Window Size On Retina Macbook Pro
« Reply #6 on: July 22, 2016, 10:07:13 pm »
This isn't so much as a bug as it is just how SFML works right now. Currently, SFML does not distinguish between physical pixels and virtual coordinates, and it is impossible to add without significant API changes (see here for discussion).

So if you are developing for OS X, you can either set NSHighResolutionCapable to true, but deal with having your windows open small/other scaling issues, or you can set NSHighResolutionCapable to false, but have your app seem "blurry" on retina displays.

I also put together a little project here that will build two apps from the same codebase, one with NSHighResolutionCapable true, and the other one false, making it really easy to see how this option affects an application.

 

anything