On a mission to save a vital feature without which any game may as well not exist, I dug around a bit and got the desktop Fader working correctly with our OpenGL window.

I was (and I assume everyone else is, too) getting supposedly transparent windows appearing for an instant at full alpha, or not appearing at all thanks to the fact that doing anything but just displaying OpenGL content is less than well-supported.

All you do to fix that is have the Fader finish its business before initing OpenGL.

For me, that looks like the below, after main game window creation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
        if (Window)
        {
            ToggleFullscreen(Window);

            BeginFadeToGame(&Fader);
            r32 dFader = 1.0f / 60.0f;
            while (UpdateFade(&Fader, dFader, Window) != Win32Fade_WaitingForShow)
            {
                MSG Message;
                while (PeekMessage(&Message, 0, 0, 0, PM_REMOVE))
                {
                    TranslateMessage(&Message);
                    DispatchMessageA(&Message);
                }
                Sleep((u32) (dFader * 1000.0f));
            }


I also threw in the BeginFadeToGame call, which initializes the rest of the win32_fader structure (and which we currently never call, getting away with it because the zero values for the fields match the values it sets).

Note that the above just sits around not doing anything useful while the fade happens. Yep.

Also, note that this doesn't fix fading out on quit, which still has all the above issues and is a far thornier thing to tackle thanks to "do it before you init OpenGL" not being an option once the game is running.

Anyway, for those wanting to do stuff like this with OpenGL apps, I assume this is the general idea for making it work.