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

Author Topic: How to have a fullscreen window Stretch to fit the screen?  (Read 6930 times)

0 Members and 1 Guest are viewing this topic.

Nyrus

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to have a fullscreen window Stretch to fit the screen?
« on: October 30, 2011, 09:45:31 pm »
Hello, I'm just starting with SFML, and I'm trying to figure out how to make a render window go into fullscreen and have it stretch to fit the screen. For  example, a 800x600 screen stretching to a 1280x800 monitor.

Is it possible? If so I would be grateful for any help.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to have a fullscreen window Stretch to fit the screen?
« Reply #1 on: October 30, 2011, 10:30:37 pm »
The window style (3rd parameter of constructor/Create) must be sf::Style::Fullscreen.
Laurent Gomila - SFML developer

Nyrus

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to have a fullscreen window Stretch to fit the screen?
« Reply #2 on: October 31, 2011, 04:10:19 am »
Thank you for your response.
Though I'm afraid I wasn't too clear, as you seem to have misunderstood me. I know how to make a window go into Fullscreen mode already.
Though when I use a screen resolution that is smaller than the current resolution of the computer, it makes black space/borders around the screen during Fullscreen.
This is most likely because I am using a 4:3 Resolution (800x600) on a 16:10 Monitor (1280x800). Is there a way to instead stretch pixels of the screen the image to fit the monitor.
I'm going to use an image to try to help explain what I want to do.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to have a fullscreen window Stretch to fit the screen?
« Reply #3 on: October 31, 2011, 07:44:00 am »
Fullscreen is supposed to stretch the window to the entire screen, this is the standard behaviour.

So where are those borders coming from? Your OS? Your window manager (in case of Linux)? Do you see them only with SFML?
Laurent Gomila - SFML developer

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
How to have a fullscreen window Stretch to fit the screen?
« Reply #4 on: October 31, 2011, 10:50:19 am »
Some monitors also include settings to disable stretching. Mine calls it "Preserve aspect ratio".

The Windows Nvidia drivers also call it the same thing.

Odds are it is in your graphics drivers of monitor settings. This particular setting is great for playing old games(I hate the stretch :D).

Naufr4g0

  • Full Member
  • ***
  • Posts: 112
    • View Profile
How to have a fullscreen window Stretch to fit the screen?
« Reply #5 on: November 04, 2011, 12:55:45 pm »
I think is better to use native resolution of the monitor, playing with sf::View(s). :)

masterlobo360

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: How to have a fullscreen window Stretch to fit the screen?
« Reply #6 on: April 23, 2012, 09:07:52 am »
Sorry about the necropost but I am having the same issue as OP.

Has there been any new discovories surrounding this situation?

Thanks in advance (and sorry if the necropost seems bothersome).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to have a fullscreen window Stretch to fit the screen?
« Reply #7 on: April 23, 2012, 09:25:33 am »
I think this thread already explains everything, so what are you looking for?
Laurent Gomila - SFML developer

masterlobo360

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: How to have a fullscreen window Stretch to fit the screen?
« Reply #8 on: April 24, 2012, 07:46:16 am »
so it's 100% hardware dependant?

The stretching is not happening properly due to our graphic cards?

Is there any workaround without meddling with the graphic card config (since it should be application-dependant not hardware-dependant)?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to have a fullscreen window Stretch to fit the screen?
« Reply #9 on: April 24, 2012, 08:05:01 am »
The default behaviour is to stretch to the entire screen. So if this is not what happens, it's your graphics card or monitor settings that interfers.
Laurent Gomila - SFML developer