views:

281

answers:

2

Hi !

I wrote a free game a few years ago: http://www.walkover.org. For the lobby and menus, it uses normal dialogs like win32. When the actual game starts it uses OpenGL.

Now, on Windows 7, when the actual game starts, it switches windows aero glass off and switches it back on when the game is over.

Is there something I can do to prevent this from happening? Some special flags that keep the glass on if it is on? (For newer, I have been using DirectX and this doesn#t happen there.) Maybe some (new) flag I have to specify somewhere?

Thx Marc

[edit]

I'm using this pixelformatdescriptor:
    static PIXELFORMATDESCRIPTOR pfd =
    {
        sizeof(PIXELFORMATDESCRIPTOR),  // size of this pfd
        1,                              // version number
        PFD_DRAW_TO_WINDOW |            // support window
          PFD_SUPPORT_OPENGL |          // support OpenGL
          PFD_DOUBLEBUFFER,             // double buffered
        PFD_TYPE_RGBA,                  // RGBA type
        32,                             // 24-bit color depth
        0, 0, 0, 0, 0, 0,               // color bits ignored
        0,                              // no alpha buffer
        0,                              // shift bit ignored
        0,                              // no accumulation buffer
        0, 0, 0, 0,                     // accum bits ignored
        0,                              // 32-bit z-buffer
        0,                              // no stencil buffer
        0,                              // no auxiliary buffer
        PFD_MAIN_PLANE,                 // main layer
        0,                              // reserved
        0, 0, 0                         // layer masks ignored
    };

[/edit]

A: 

Not sure exactly what you're doing that's causing this, but it's probably just as well -- Microsoft's OpenGL implementation in Windows 7 is not exactly perfect, to put it nicely. In fact, in most of my OpenGL code, I've taken to explicitly turning off the DWM. Otherwise, bugs in Microsoft's implementation basically stop it from working at all. Though I can work around that some extent in other ways, the performance is so poor it renders the code essentially unusable anyway (I haven't done serious measurements, but at an immediate guess I'd say at least 5:1 performance loss).

Jerry Coffin
+1  A: 

I think this can happen if you create an OpenGL rendering context that is incompatible with Aero Glass. IIRC one of the cases that can cause this is if you create a window using 16-bit colour. Aero Glass can't render in 16-bit colour, so for some technical reason, Windows has to completely disable Aero Glass (even though only your app is using it). Try using 32-bit colour.

There might be other settings that disable it for similar reasons. In short, double check all the settings you're creating OpenGL with, and think "would Aero Glass switch off if the desktop was switched to this mode?".

AshleysBrain
Hah, oh well. That game is so old, I completely forgot that I initialize OpenGL in 16bit. You are right, that'ld make sense to be the cause. I'll try modifying it and report back.
marc40000
Nah, I changed the 16bit to 32 or 24, still the same effect. Is it generally not possible to do this? I added the Pixelformatdescriptor I use above in my question.
marc40000