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

Author Topic: Visible border around fullscreen window (retina)  (Read 4358 times)

0 Members and 1 Guest are viewing this topic.

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Visible border around fullscreen window (retina)
« on: August 13, 2014, 03:04:14 am »
I am testing high dpi resolution on a macbook pro retina. Windowed mode works great but I noticed that resolutions lower than desktop show up with a border in fullscreen. The window pixel size is accurate but does not scale to cover the full screen.

The following valid resolutions are affected:
  • 2560 x 1600
  • 1680 x 1050
  • 1440 x 900
  • 1280 x 800
Here's a small complete program to reproduce the problem provided you can test on a macbook pro retina. You will see a white rectangle that matches windows size yet does not take the whole screen.

#include <SFML/Graphics.hpp>

int main(int, char const**)
{
    sf::RenderWindow window(sf::VideoMode(1680, 1050), "SFML window", sf::Style::Fullscreen);
   
    sf::RectangleShape shape;
    shape.setSize(sf::Vector2f(1680, 1050));
   
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::KeyPressed) {
                window.close();
            }
        }

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

    return EXIT_SUCCESS;
}
 

I have compiled SFML from the latest github code and testing on osx 10.9.4. The display settings are set to default "best for display".

Is this intended behavior? is it possible to make the lower resolution scale to fullscreen? of course the fullscreen window size is fine at the native 2880x1800 but it does take hit on performance.
Blokade: Source

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Visible border around fullscreen window (retina)
« Reply #1 on: August 13, 2014, 09:18:44 am »
It is indeed the intended behaviour. If you ask for 800x600 you get 800x600. If you want to scale 800x600 to something else then use views.

Quote
of course the fullscreen window size is fine at the native 2880x1800 but it does take hit on performance.
Do you have proof?
SFML / OS X developer

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Visible border around fullscreen window (retina)
« Reply #2 on: August 13, 2014, 11:20:45 am »
I dont know about Macs, but I think thats not a SFML problem, because normally there should be an option in the video driver to either have black bars or to resize when using a nonfitting resolution?

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Visible border around fullscreen window (retina)
« Reply #3 on: August 13, 2014, 01:57:14 pm »
Quote
It is indeed the intended behaviour. If you ask for 800x600 you get 800x600. If you want to scale 800x600 to something else then use views.
Fair enough, answers my question.

Quote
Do you have proof?
Yes, with a single sprite that covers 2880x1800 I drop 1 FPS. As you stated, I will implement a view scaled up and see how it goes.

Quote
normally there should be an option in the video driver to either have black bars or to resize when using a nonfitting resolution?
I remember that setting back when I used a PC. The corresponding feature also affects the desktop on osx.

Thanks for your input!
Blokade: Source

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Visible border around fullscreen window (retina)
« Reply #4 on: August 13, 2014, 07:21:30 pm »
Quote
Do you have proof?
Yes, with a single sprite that covers 2880x1800 I drop 1 FPS.
By 1 FPS or to 1 FPS?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Visible border around fullscreen window (retina)
« Reply #5 on: August 13, 2014, 07:29:29 pm »
This black letterbox has nothing to do with the graphics driver. I put them on purpose to avoid a hard video mode switch which would result in resizing all open windows, moving items on the desktop and so on. With modern graphic card no performance drop should be noticed and it follows more closely Apple's guidelines.

Now, if you want to measure performance, you'll have to modify SFML internal to use a hard switch or something similar.
SFML / OS X developer

moonfirefly

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Visible border around fullscreen window (retina)
« Reply #6 on: August 13, 2014, 07:56:49 pm »
Quote
By 1 FPS or to 1 FPS?
By 1 FPS yes.

Quote
I put them on purpose to avoid a hard video mode switch which would result in resizing all open windows, moving items on the desktop and so on.
Thanks for the clarification.

Quote
Now, if you want to measure performance, you'll have to modify SFML internal to use a hard switch or something similar.
I won't go there. I got insight which pertains to borders in fullscreen and why it happens. I will proceed with desktop resolution in fullscreen and handle lower res in a scaled view where applicable. From there I will reassess performance.

Thanks all  :)
Blokade: Source

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Visible border around fullscreen window (retina)
« Reply #7 on: August 14, 2014, 05:20:46 pm »
Having a drop of 1 fps (or X fps for that matter) means nothing without context. Just to give you an example, if you originally had 200 fps then each frame needs 1/200s=0.005s to render. Whereas with 199 fps, you need 0.005025126s to render a frame. That means a 0.50252% drop in performance which is basically nothing. However, if you had originally 2 fps and now only 1 fps it means a 50% performance drop....

Before attempting to make any optimisation in your project, make sure you benchmarked it correctly and you know it's worth working hard to make a specific part of your app faster.
SFML / OS X developer

 

anything