SFML community forums

Help => Window => Topic started by: SirPsychoMantis on November 29, 2012, 11:08:23 pm

Title: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 29, 2012, 11:08:23 pm
Hi there,  I'm quite new to SFML, currently looking to learn more about it.

One of my favorite things about many modern games is their addition of a "Windowed Fullscreen" video option in addition to regular windowed and regular fullscreen, where the game appears to be fullscreen, but the user is able to alt tab and have windows floating over the game.

I tried creating a window with the dimensions of my desktop + sf::Style::None, but this seemed to force regular fullscreen mode.  Is there any way to achieve windowed fullscreen, and if not, are there any plans to support it?

EDIT: This is what I am referring to (http://pcgamingwiki.com/wiki/Borderless_fullscreen_windowed)

EDIT 2: So it seems like it isn't full fullscreen mode, but the alt-tabbing was quite iffy on my laptop, while on my desktop it is a bit better, but still sometimes the taskbar does not reappear and the screen flickers on alt-tab
Title: Re: "Windowed Fullscreen" mode?
Post by: Laurent on November 30, 2012, 08:00:03 am
Indeed, it doesn't force regular fullscreen mode, so it should work fine.

What's your OS? And what does "iffy" means exactly?
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 30, 2012, 04:45:31 pm
Indeed, it doesn't force regular fullscreen mode, so it should work fine.

What's your OS? And what does "iffy" means exactly?

On my laptop the alt-tab preview box wouldn't come up immediately, sometimes alt tabbing would not cause the other window to display.

Poking around more on my desktop, I added a quick animation and the green sphere had vertical tearing while the window was focused, and no tearing when not focused.  There appeared to be a flicker as if some video mode changed when alt-tabbing as well as the task bar not appearing immediately on alt-tab.

Both are Windows 7 64-bit

EDIT: Tested again on my laptop: If I alt tab once, the other window does not appear.  If I alt tab back, the screen flickers like a video mode change happened, and from there it works properly as a borderless windowed fullscreen.

Code: [Select]
int main()
{
        sf::VideoMode desktop = sf::VideoMode().getDesktopMode();
sf::RenderWindow window(desktop, "SFML works!", sf::Style::None);
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);

int x = 0;

sf::Clock clock;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}

sf::Time dt = clock.restart();

x++;
if (x > 100) {
x = 0;
}

window.clear();
shape.setOrigin(x, 0);
window.draw(shape);
window.display();

if (sf::Keyboard::isKeyPressed(sf::Keyboard::Q))
{
return 0;
}
}

return 0;
}
Title: Re: "Windowed Fullscreen" mode?
Post by: eXpl0it3r on November 30, 2012, 04:59:58 pm
There appeared to be a flicker as if some video mode changed when alt-tabbing as well as the task bar not appearing immediately on alt-tab.
Like you said it appears to change the resolution, but it doesn't. So I'm unsure what more information you need.
Your provided code works without problems, see the video:

http://www.youtube.com/watch?v=567Fw9V3cGg (http://www.youtube.com/watch?v=567Fw9V3cGg)
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 30, 2012, 05:28:42 pm
Some more information: I am using the nightly build for Visual C++ 11.  Also I tried recording a quick video, but the screen was blank when I was focused on the window, so somehow it is in some kind of fullscreen mode.  How can I get more information from the program about this?
Title: Re: "Windowed Fullscreen" mode?
Post by: eXpl0it3r on November 30, 2012, 06:07:11 pm
Also I tried recording a quick video, but the screen was blank when I was focused on the window
Well you're clearing it with black so no wonder... ;D

so somehow it is in some kind of fullscreen mode.
No, it's not. Unless you use sf::Style::Fullscreen you're not in any fullscreen mode, just a window that matches the screen resolution.

How can I get more information from the program about this?
Information about what exactly? You're constantly quite vague where & what the problem is... ;)
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 30, 2012, 06:33:11 pm
Also I tried recording a quick video, but the screen was blank when I was focused on the window
Well you're clearing it with black so no wonder... ;D

While the window is focused I see the green ball, but the video capture software (XSplit) does not.  This usually happens with fullscreen games.  When I don't have the window focused, XSplit does capture it. 

I compared with a quick fullscreen window in pygame and the video mode stutter does not happen on alt tab, nor is there a delay of the taskbar appearing.

Also by more information, I mean possibly some function that can check if the window is currently in fullscreen mode?
Title: Re: "Windowed Fullscreen" mode?
Post by: Laurent on November 30, 2012, 09:17:15 pm
Well, it's not. I think you can trust me, since I wrote the code ;)
And in case you don't trust me, check by yourself, the code is very easy to follow.
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 30, 2012, 09:36:35 pm
Here is a video of what is happening:

On my actual screen the ball does not stop moving

http://www.youtube.com/watch?v=tEr3nydI8tI (http://www.youtube.com/watch?v=tEr3nydI8tI)

Is it hardware acceleration kicking in?  I'm just trying to figure out what is going on, as it seems a bit off, not a ridiculous huge problem.
Title: Re: "Windowed Fullscreen" mode?
Post by: eXpl0it3r on November 30, 2012, 10:48:27 pm
Is it hardware acceleration kicking in?
SFML is always hardware accelerated (at least if you GPU does support OpenGL, which about every single GPU does...). ;)

I'm just trying to figure out what is going on, as it seems a bit off, not a ridiculous huge problem.
What exactly seems off?
If you're talking about the recording, then 'blame' the recording software and not SFML/your code. ;D
Try setting a framerate limit (window.setFramerateLimit(60)), since it will take off quite a bit of the CPU load and maybe the recording software gets a better chance at recording the movement.
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 30, 2012, 11:10:45 pm
Is it hardware acceleration kicking in?
SFML is always hardware accelerated (at least if you GPU does support OpenGL, which about every single GPU does...). ;)

I'm just trying to figure out what is going on, as it seems a bit off, not a ridiculous huge problem.
What exactly seems off?
If you're talking about the recording, then 'blame' the recording software and not SFML/your code. ;D
Try setting a framerate limit (window.setFramerateLimit(60)), since it will take off quite a bit of the CPU load and maybe the recording software gets a better chance at recording the movement.

Set frame limit to 60, same effect.  Might just be giving up on this one  :-\ .  The main thing is that something is happening to the video mode on alt-tab that doesn't happen with other programs that do the fullscreen windowed, like my other little demo as well as Starcraft 2.
Title: Re: "Windowed Fullscreen" mode?
Post by: eXpl0it3r on November 30, 2012, 11:20:46 pm
The main thing is that something is happening to the video mode on alt-tab that doesn't happen with other programs that do the fullscreen windowed, like my other little demo as well as Starcraft 2.
How do you know that?
Until now you only state that you think/feel/notice by behavior X of program Y while you have the expectation Z that things change, those are just your intuitions and don't have anything to do with what's actually going on.
In literature, philosophy, etc. feelings and intuition may lead somewhere, but in computer science the only thing that counts are facts, pure facts. So get some software (that is: google it) which shows your resolution changes/states and check what happens. I bet you quite a bit that there's no resolution change at all. ::)
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on November 30, 2012, 11:30:53 pm
The main thing is that something is happening to the video mode on alt-tab that doesn't happen with other programs that do the fullscreen windowed, like my other little demo as well as Starcraft 2.
How do you know that?
Until now you only state that you think/feel/notice by behavior X of program Y while you have the expectation Z, those things are just your intuition and don't have anything to do with what's actually is going on.
In literature, philosophy, etc. feelings and intuition may lead somewhere, but in computer science the only thing that counts are facts, pure facts. So get some software (that is google it) which shows your resolution changes/states and check what happens. I bet you quite a bit that there's no resolution change at all. ::)
Facts (assuming all using "borderless fullscreen windowed")
Fact: The screen flickers when alt tabbing, other games do not
Fact: The taskbar takes several seconds to appear, in other games this does not happen
Fact: Video capture software is not capturing in one state (while focused), in other games this does not happen

I'm not saying the resolution is changing (obviously the same dimensions), but something about the video mode, as if going from fullscreen to windowed.  I know you think I'm some newbie user who is making things up, but there are small differences in the behavior that I have noticed and all I'm trying to figure out is why.
Title: Re: "Windowed Fullscreen" mode?
Post by: eXpl0it3r on November 30, 2012, 11:41:17 pm
Facts (assuming all using "borderless fullscreen windowed")
That's already an assumption which goes too far, because probably none of 'other games' do use SFML, thus there's a difference on how things are done.

I'm not saying the resolution is changing (obviously the same dimensions), but something about the video mode, as if going from fullscreen to windowed.  I know you think I'm some newbie user who is making things up, but there are small differences in the behavior that I have noticed and all I'm trying to figure out is why.
There can be hundreds of different reasons why things behave not the same way as you want them to, but jumping to the conclusion that it has to be the video mode is wrong. Never focus on one particular spot unless you have prove that it's caused by that spot. ;)
Rather try to figure out what your 'other games' exactly do underneath and compare it to what SFML does. Also notice that there might be a huge difference between DirectX and SFML (OpenGL) applications.
As Laurent already said SFML's code is fairly simple to understand and maybe you see some part that could lead to such an undesired behavior.
Title: Re: "Windowed Fullscreen" mode?
Post by: SirPsychoMantis on December 01, 2012, 12:08:57 am
Facts (assuming all using "borderless fullscreen windowed")
That's already an assumption which goes too far, because probably none of 'other games' do use SFML, thus there's a difference on how things are done.

I'm not saying the resolution is changing (obviously the same dimensions), but something about the video mode, as if going from fullscreen to windowed.  I know you think I'm some newbie user who is making things up, but there are small differences in the behavior that I have noticed and all I'm trying to figure out is why.
There can be hundreds of different reasons why things behave not the same way as you want them to, but jumping to the conclusion that it has to be the video mode is wrong. Never focus on one particular spot unless you have prove that it's caused by that spot. ;)
Rather try to figure out what your 'other games' exactly do underneath and compare it to what SFML does. Also notice that there might be a huge difference between DirectX and SFML (OpenGL) applications.
As Laurent already said SFML's code is fairly simple to understand and maybe you see some part that could lead to such an undesired behavior.

I never said it had to be that, I was just giving my best guess.

It could just be a quirk of OpenGL, but I'm not sure, and I was hoping that someone would have better knowledge of OpenGL than I do.
Title: Re: "Windowed Fullscreen" mode?
Post by: cire on December 01, 2012, 12:33:04 am
If you're holding the ALT key down while you're tabbing and another window has the focus, Windows will show you a snapshot of the screen you're previewing.  That doesn't mean your program has stopped or is experiencing a delay.  It means Windows is showing you a snapshot.