CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2010
    Posts
    1,133

    [RESOLVED] Windows UI Drawing Method Adapts to Available Resources?

    Maybe this is not the right forum, but it is a question related to graphics programming, so...

    A friend of mine has Windows 7 on his laptop, and DirectX runtime is not installed (except for the Direct2D libraries (I think – no more DirectDraw, right?) that apparently come with Windows). Now, we were playing some Sega Genesis games using the Gens emulator, set to use “DirectDraw” option since Direct3D is not available.
    If u ever used this emulator, you know that when u run it the screen turns black for a moment, while the program initializes its graphics system.

    I noticed that Windows 7 changes its behavior while Gens is running, in terms of UI presentation – the blurry window frame becomes solid, app thumbnail representations (when you hover the mouse pointer over an app button on the taskbar) are replaced with text, etc.

    Is this a result of Windows readjusting itself to the available resources, or the program somehow changes the way Windows draws its UI? Is the latter even possible?

  2. #2
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Windows UI Drawing Method Adapts to Available Resources?

    I'm betting that it's an incompatibility issue. DirectX is now on version 11.
    Gort...Klaatu, Barada Nikto!

  3. #3
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Windows UI Drawing Method Adapts to Available Resources?

    Could be.
    (Just in case there was a misunderstanding: Gens runs fine - it's what's going on during the initialization, and how it effects the UI, that I'm interested in.)
    But I think this is the way the application operates - I noticed the emulator has similar effect on WinXP, except it's far more subtle (see the attachment).

    I'm thinking it could be some hack by the developers used to maximize performance (and this is what makes it interesting; however, in that case this is something only the developers could answer).

    But, it could also be related to a number of things - maybe it's some mechanism of the OS, or maybe it has something to do with SDL (since the app uses it), or it could even be related to the GPU.

    P.S. As for the disabled Direct3D option, it seems that I was wrong - in this variant of Gens (Gens Plus), it appears that it always stays disabled (even on systems that can support it), indicating that this is only a feature that is planned for a future version.

    ATTACHMENT: Effects on Windows XP (start menu icons)
    Attached Images Attached Images
    Last edited by TheGreatCthulhu; February 27th, 2010 at 05:52 AM.

  4. #4
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Windows UI Drawing Method Adapts to Available Resources?

    I would guess from those image captures that it is setting the screen bpp to some lower mode.

    As for your earlier comment about Windows7, there's one or two legacy apps (the only one I can think of right now is WinAVI when it starts an mpeg remux) that cause this behavior in Win7; however, on my system, it warns me with a popup balloon, telling me that the application requires that the UI be set to some mode or other. I can't recall the exact message, but it has the same effect: the glass-look and hover glow stuff all goes away until the app is done.

  5. #5
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Windows UI Drawing Method Adapts to Available Resources?

    Have you tried runing the app in XP compatibility mode? Do you get different results?
    Gort...Klaatu, Barada Nikto!

  6. #6
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Windows UI Drawing Method Adapts to Available Resources?

    Quote Originally Posted by Mike Harnad View Post
    Have you tried runing the app in XP compatibility mode? Do you get different results?
    I tried to play with compatibility modes to see what happens, but I observed no significant differences. Again, the application runs the way it's supposed to, and this behavior is normal and expected. I just wanted to know what is happening during initialization and how it is done.

    Quote Originally Posted by hoxsiew View Post
    I would guess from those image captures that it is setting the screen bpp to some lower mode.
    Turns out you were right. I was so blinded by my theory that it is some exotic code that is behind it (), that I didn't see it.
    This is the simplest explanation and it is correct. I've done some research, and there's no doubt anymore.

    First, take a look at the image I attached, showing the effect on Windows 7, and on the display mode.

    Second, as I said before, this program uses SDL, and in SDL documentation you can find the following method:
    SDL_Surface* SDL_SetVideoMode(int width, int height, int bitsperpixel, Uint32 flags);


    Third, Gens is an open Source project, so when I downloaded the code I searched for this method, and I found the following line in the file g_sdldraw.c (version gens-2.15.5, path: src\gens\sdllayer\g_sdldraw.c, Ln 217), in a method called Init_draw_sdl:

    screen = SDL_SetVideoMode(w,h,16,sdl_flags|(Full_Screen?SDL_FULLSCREEN:0));

    Note that the third parameter is set to 16 bpp.
    I also tried to change the screen bpp manually back to 32 bpp using display settings, which revealed that Gens won't display anything at all in this mode.


    And finally, I was able to find a change log somewhere on the net, with the foolowing entry:

    (02/09/2000) Changes Gens 0.8 <- Gens 0.78b :
    ---------------------------------------------

    [...]

    * Auto Switch to 16 BPP when Gens starting
    (settings are recovered when Gens exiting)

    [...]



    As for the behavior of Windows 7 - this means that it has different UI rendering strategies for different display settings.
    Attached Images Attached Images

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured