Results 1 to 11 of 11

Thread: Fullscreen behavior under Windows

  1. #1

    Default Fullscreen behavior under Windows

    Hi!

    I recently returned to a sleeper project of mine, which of course uses the excellent ClanLib library.
    I used a checkout of the development branch of version 0.9 in the past (last update being roughly at the end of February). Before starting, I updated to a current checkout of the development branch of 2.0 a few days ago. After a a bit testing around, I noticed that the fullscreen mode was somehow broken. Instead of switching the screen resolution, it just maximized the window. I remembered it working in the past, so I tried my 0.9 checkout and it surely did work. So I started searching for differences in the code and reading the commits, thinking it was a bug introduced in the mean time. I was surprised to see, that this has been done intentional. To quote the commit: "Disabled screen mode switching on WIN32" (Rev. 3258 on 30. June 2009). And it's not just disabled, but removed completely. Any reason why? I searched around, but could not find anything related to this, nor any sign that it will return in the future.

    The current behavior is not really satisfying, because it is not possible to get a "true" Fullscreen window. Switching to Fullscreen normally means setting the screen size to the window size, not maximizing the window size to screen size. This is an important difference, since switching to fullscreen in the first case does not increase the window size.
    Furthermore it is a discrepancy between the Windows and Linux behavior, as far as I interpret the source (which could be incorrect, as I did no in-depth investigation). So, while on Linux the 640x480 window is still 640x480 in Fullscreen, on Windows the same window is maybe 1280x1024 in Fullscreen.

    Is "true" Fullscreen (a.k.a. switching screen resolution) under Windows out for good or just "disabled" for the time being? Or have I overlooked something?

    Thanks in advance.

  2. #2

    Default

    Hi,

    I'm currently trying to find a way to fix this problem in my game engine.

    Rather than starting a new thread, I would like to echo what TheBlackHand said, I can't find any possible reason why full-screen mode was disabled, what's the benefits? because there sure are serious drawbacks.

    Thanks.

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Just to clear up possible confusion for other readers of this thread

    CL_DisplayWindow - "FullScreen" is a borderless, unresizable, captionless window with the fullscreen option set, that stretches the window to the screen size.

    In previous versions of ClanLib V0.8 and V1.0, "FullScreen" also meant changing the screen resolution.

    Thats caused some problems. 1) You may not want the screen resized. 2) It sometimes caused problems debugging a fullscreen app on windows. 3) The screen may not support the desired screen size (eg, a wide screen laptop)

    Ideally (in my opinion) CL_DisplayWindowMode ( http://www.clanlib.org/docs/clanlib-...indowMode.html ) should control the screen size via a "set_mode()" function.

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    One of the major issues with fullscreen under OpenGL is that Microsoft doesn't really support OpenGL well. If you have a crashing fullscreen OpenGL game, Windows won't restore the desktop resolution.

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Even worse, if you change the resolution using other means than Direct3D, it rearranges all open windows and desktop icons to fit within the resolution of the game. This makes resolution-changing OpenGL very annoying.

    With modern graphics cards and LCD monitors there's little sense in changing the actual screen resolution anymore. A much better approach is to render to an off-screen texture that has the size you desire, then stretch that one to the size of the back-buffer and flip that to front.

    It has the following benefits:

    1. You escape the resolution changing problem with non-directx applications
    2. With modern graphics cards the last stretching operation is very cheap
    3. Because you stretch it yourself, it is not the LCD monitor hardware that stretches it. You control the quality of the stretch now
    4. Alt-tabbing is much more pleasant now.
    5. You better support the situation where a gamer might want to be both logged into your game and do other stuff (particular important for mmorpgs and turn based games)
    6. No need for complex tricks to ensure the resolution is restored if your application crashes or hangs


    Its bit unclear on your post if you are asking about why set_fullscreen() on CL_DisplayWindow was removed. But just in case that's the real question, here's an answer to that:

    One of the bigger differences between Direct3D and OpenGL is the way the flipping buffers and resources are handled.

    In OpenGL, you can resize the window and this automatically resizes the front and back buffers to match the new dimensions of the window. This makes it easy to resize things. On the other hand, OpenGL does not have any 'set fullscreen' command, so to achieve this you have to use platform specific code. On Windows this code pretty much maps to a call to ChangeDisplaySettingsEx. This function broadcasts a WM_DISPLAYCHANGE to all windows, which causes them to constrain themselves to the size of your fullscreen resolution (bummer). This has been an issue for 15 years now and I have a feeling Microsoft does not want to fix this. They want you to use Direct3D..

    Direct3D does not resize its front and back buffers. So when you create your D3D device, you tell it you want it to be 640x480 and when you resize the window it simply starts stretching the 640x480 front buffer to your new window dimensions. To make matters worse, if you try to destroy and create new flipping buffers, Direct3D destroys ALL your 3D resources (textures, vertex buffers, etc). Thanks Microsoft. On the plus side, they do have a SetFullscreen() call, which does not broadcast WM_DISPLAYCHANGE, so at least you can go fullscreen at 640x480 (but only that resolution).

    Add to the above that resolution changing and fullscreen windows under Unix is quite messy, with a X server that doesn't play nice always and an unknown amount of different window managers with their own hints for how to request the proper window decorations.

    I removed the set_fullscreen() function from CL_DisplayWindow because I felt I wasn't a good enough coder to be able to actually make this function work under the conditions people expected it to work.

    That said, if someone knows how to avoid these limitations in Direct3D and OpenGL with regard to fullscreen and window resizing, I am all ears. If someone feels like they'd like to contribute in this area it would be even better.

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Quote Originally Posted by Magnus Norddahl View Post
    With modern graphics cards and LCD monitors there's little sense in changing the actual screen resolution anymore. A much better approach is to render to an off-screen texture that has the size you desire, then stretch that one to the size of the back-buffer and flip that to front.
    It is easier to use the following code: (Using a "working" screen size of 800 * 600)
    Code:
    (in main loop)
    CL_GraphicContext gc = main_window.get_gc();
    CL_Mat4f matrix = CL_Mat4f::scale( (float) gc.get_width() / 800.0f, (float) gc.get_height() / 600.0f, 1.0f);
    gc.set_modelview(matrix);

    For refererence, to set the window to fill the entire screen, use this code:

    Code:
    CL_DisplayWindowDescription desc;
    desc.set_title("mygame");
    desc.set_size(CL_Size(800,600), true);
    if(fullscreen)
    {
    	desc.set_fullscreen(true);
    	desc.set_decorations(false);
    }
    else
    {
    	desc.set_allow_resize(true);
    }
    main_window = CL_DisplayWindow(desc);

  7. #7

    Default

    I personally thank you all very much for the replies, I know how a time consuming task it is to write technical detailed posts.

    For me, I understand the drawbacks you mentioned, but they are inconveniences and don't really impact the process of developing the game itself, it's just the price I have to pay, and pretty much most other games whether commercial or not do suffer some of the consequences, obviously Direct3D based games are in a better position, however losing and having to recreate everything when fullscreen exclusiveness is interrupted certainly sucks more than all fullscreen OpenGL drawbacks combined.

    As for the benefits (at least for me), the obvious one is that when a low detail game is displayed on a suitable resolution, it looks somewhat more satisfying compared to displaying it on double the resolution (consequences of my fail game art ), the not so obvious benefit is the ability to constrain the game looks to 1 or 2 display ratios (usually 4:3 and 16:10) without having to stretch unevenly and hence maintaining the correct ratio of all game components for most of gamers.

    I have already fixed the problem in my game engine by making it do the display resolution switching itself (using ChangeDisplaySettingsEx).

    So, how about leaving the choice of changing the display mode to the ClanLib user? (and of course warn about the consequences in the documentation or something ) removing it completely was the reason that inspired me to ask about the issue in the first place, I think the same goes for TheBlackHand too.

  8. #8
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    That's why I personally prefer adding set_mode to http://www.clanlib.org/docs/clanlib-...indowMode.html instead.

    The application code uses

    std::vector<CL_DisplayWindowMode> &modes = CL_DisplayWindowMode::get_display_modes();

    Then scans the list to see if it contains any valid aspect ratio.

    Then uses set_mode() on it.

    But I don't have any personal interest in creating a patch (I'm far to busy elsewhere)

  9. #9
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Someone has disabled CL_DisplayWindowMode() on linux.

    I believe this is because, XF86VidMode is quite useless because it will only report the current mode on most systems.

    (and there is no implementation of that for Apple either)

    Additionally, it causes compile issues because you need to link with the library even if you don't use this functionality.

    And since it is an optional part of ClanLib build, you cannot really know whether you actually need to link it or not.

    My suggestion is to remove CL_DisplayWindowMode() totally from the API (including Win32)

    (It is possible that on some Win32 systems, you cannot change video mode due to specified limited user permissions, but I don't know for sure)

  10. #10

    Default

    For the last few days, I was trying to install Linux (OpenSUSE 11.1) and multiboot with Windows XP and Vista, GRUB has given me nightmares, only yesterday did I manage to finally make things work.

    I already patched ClanLib but for Windows only (it isn't really a patch, all I did was restoring the removed code to a set_mode method), on Linux, I am completely clueless towards how to switch to full-screen and frankly I don't know what is XFree86 exactly, I guess someone needs to educate himself about something

    Seeing that you are suggesting the removal of CL_DisplayWindowMode altogether, I guess you no longer need the patch anyway, but it wasn't wasted time because I got OpenSUSE with perfect multiboot out of it.

    Thanks

  11. #11
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Further notes for reference:

    From "Debian Devel Games" mailing list:

    Code:
    There is a bug in Red Hat's bugzilla and I talked with various xdevs about
    this, but it is not trivial to fix for them, or so I've been told.
    
    Also we don't need to fix all games, most use a handful if libs, for
    Fedora those 3 patches are all that is needed.
    
    Also note that xf86vidmode is considered sort of deprecated by upstream xorg,
    so the chances of getting this fixed there are not too good.

Similar Threads

  1. Fullscreen problems
    By Veitikka in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 03-27-2008, 11:02 AM
  2. Error on Fullscreen switch
    By madmark in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 11-30-2007, 06:47 PM
  3. Fix for Fullscreen mode
    By glorified_ameba in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 07-27-2007, 04:22 PM
  4. make fullscreen 1280x1024
    By gmatt in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-25-2007, 08:34 AM
  5. Novashell fullscreen overrides command-tab app swithing in osx
    By whisperstorm in forum Novashell Game Creation System
    Replies: 2
    Last Post: 01-13-2007, 06:32 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •