   Aero switching off when OpenGL window covers full screen
  I've now finally moved to Windows 7 after many many years of using Windows XP and immediately ran across the issue that my OpenGL applications appear to not like Aero very much (or vice versa). It's not like that they wouldn't run or anything. But it annoys me to no end that my screens start flashing and messages pop up about windows switching off Aero. Strangely windows immediately switches Aero back on even if i merely tab out with the window still fully visible.While trying to fix this issue i noticed that in order to tell windows that my application is well aware of Aero i need to set the pixel format descriptor flag PFD_SUPPORT_COMPOSITION as described here:http://www.opengl.org/pipeline/article/vol003_7/In order to set FSAA, however, i am currently using wglChoosePixelFormatARB() instead of the standard ChoosePixelFormat() function - part of the WGL_ARB_pixel_format extension as described here:http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txtFor all i can tell it appears as if wglChoosePixelFormatARB() provides no means to set the PFD_SUPPORT_COMPOSITION flag while standard ChoosePixelFormat() prohibits specification of FSAA, right? Strangely it does provide a WGL_SUPPORT_GDI_ARB setting.Is there any third option I'm missing? Or do i have to chose between having application defined FSAA and Aero-compliance?Edit:Ok, my bad. Kinda missed the fact that wglChoosePixelFormatARB() returns a whole array of possible formats. I just had to iterate through and pick one that has the flag.Now if i can just figure out why aero is switched off when the window goes fullscreen. It's really odd. 1280x1023: no problem, 1280x1024: aero goes offline[Edited by - IronFox on April 9, 2010 5:50:37 AM]
  you can look into multisampled framebuffers, that might get you around the issue.BUT ... I'm using windows 7 and openGL and haven't had a problem with aero. Maybe you can check msdn to find a function to disable aero at the start and reenable it when you exit?   ;  Heh, i _don't_ want Aero to switch off. Switching it off explicitly doesn't appear to help me much there :DFor all i can tell it seems to be a driver issue, though. Iterating through the results of wglChoosePixelFormatARB() returns a pixel format that supports both composition and fsaa. Doesn't appear to impress Windows 7 very much though. As soon as my window covers the main screen entirely _something_ switches off Aero. If the window is but a single pixel column or row short of the entire screen region then Aero does not switch off. Naturally running in window-mode has also no effect on Aero.I found this issue on a couple other forums, although more from a user point of view and with no solution. It appears as if some video drivers (e.g. mine) switch off Aero if a window goes full screen to save processing power. I've seen other OpenGL applications do the same on my machine.For some reason it doesn't happen with Direct3D applications though...Edit:What i don't get is why windows keeps reminding me that..."A running program isn't compatible with certain visual elements of Windows"when clicked on:"The following program has performed an action that requires Windows to temporarily change the color scheme to Windows 7 Basic"Whatever i try it always does that when the window covers the entire screen. Can anyone point me to a simple example OpenGL program (possibly including source) that doesn't cause that?I've gone through this listhttp://www.opengl.org/pipeline/article/vol003_7/at least three times now. Either they are forgetting something or (which is more likely) i am but i don't get it. Linking gdi32.lib doesn't cause that, does it? ChoosePixelFormat and the likes are derived from it. Would that count as 'using gdi'...?I wish windows would tell me what exactly my program is doing wrong[Edited by - IronFox on April 9, 2010 5:45:48 AM];  Is your window fullscreen? Can you post the code for making your window?   ;  My application doesn't change the display resolution. However there appears to be a distinction between whether the window covers the entire screen or not.I'm going to collect the portions responsible for creating window class, window, and OpenGL context as well as the basic event handling.This is where I register the window class and create the window:DWORD style = WS_POPUP|WS_CLIPCHILDREN;//|WS_CLIPSIBLINGS;_error = ERR_NO_ERROR;HINSTANCE hInstance = GetModuleHandle(NULL);WNDCLASSEXA wc;wc.cbSize = sizeof (wc);wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;wc.lpfnWndProc = (WNDPROC) WndProc;wc.cbClsExtra = 0;wc.cbWndExtra = 0;wc.hInstance = hInstance;wc.hCursor = LoadCursor(NULL,IDC_ARROW);wc.hbrBackground = NULL;wc.lpszMenuName = NULL;wc.lpszClassName = ENGINE_CLASS_NAME;wc.cbClsExtra = 0;wc.cbWndExtra = 0; wc.hIconSm = wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);if (!RegisterClassExA(&wc)){_error = ERR_CLASS_REGISTRATION_FAILED;return NULL;}hWnd = CreateWindowExA(0,ENGINE_CLASS_NAME,window_name.c_str(),style,_location.left,_location.top, //Position_location.right-_location.left,_location.bottom-_location.top, /*HWND_DESKTOP*/NULL,NULL,hInstance, //ApplicationNULL);if (!hWnd){_error = ERR_WINDOW_CREATION_FAILED;UnregisterClassA(ENGINE_CLASS_NAME,hInstance);return NULL;}ShowWindow(hWnd, SW_SHOW);UpdateWindow(hWnd);SetForegroundWindow(hWnd);SetFocus(hWnd);The OpenGL context is created twice using this method:GL_BEGINerror_code = ERR_NO_ERROR;RECT Screen;PIXELFORMATDESCRIPTOR pfd={sizeof(PIXELFORMATDESCRIPTOR),1,//versionPFD_DRAW_TO_WINDOW |PFD_SUPPORT_OPENGL |PFD_SUPPORT_COMPOSITION |//aeroPFD_DOUBLEBUFFER,//swap-buffer-systemPFD_TYPE_RGBA,//color-type supporting alpha-channelconfig.color_buffer_bits,//by default use 32 bits here0,0,0,0,0,0,config.alpha_buffer_bits,//by default use 8 bits here0,config.accumulation_buffer_bits,//should be zero by default0,0,0,0,config.depth_buffer_bits,config.stencil_buffer_bits,config.auxiliary_buffer_bits,0/*PFD_MAIN_PLANE*/,0,//reserved (for whatever)0,0,0};GLint PixelFormat;device_context = GetDC(hWnd);if (!wglChoosePixelFormat){PixelFormat = ChoosePixelFormat(device_context, &pfd);if (!PixelFormat){error_code = ERR_CONFIG_UNSUPPORTED;ReleaseDC(window,device_context);device_context = NULL;GL_ENDreturn false;}if (config.fsaa_samples)error_code = ERR_RETRY;}else{int attribs[] ={WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,WGL_SUPPORT_OPENGL_ARB, GL_TRUE,WGL_DOUBLE_BUFFER_ARB, GL_TRUE,WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,WGL_STEREO_ARB, GL_FALSE,WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,WGL_COLOR_BITS_ARB, config.color_buffer_bits,WGL_ALPHA_BITS_ARB, config.alpha_buffer_bits,WGL_DEPTH_BITS_ARB, config.depth_buffer_bits,WGL_STENCIL_BITS_ARB, config.stencil_buffer_bits,config.fsaa_samples?WGL_SAMPLES_ARB:0, config.fsaa_samples,WGL_SAMPLE_BUFFERS_ARB,config.fsaa_samples?GL_TRUE:GL_FALSE,0,0};if (!myPickPixelFormat(device_context,attribs,PixelFormat,config.fsaa_samples)){ReleaseDC(window,device_context);device_context = NULL;error_code = ERR_CONFIG_REJECTED;GL_ENDreturn false;}DescribePixelFormat(device_context,PixelFormat,sizeof(pfd),&pfd);ASSERT__(!!(pfd.dwFlags & PFD_SUPPORT_COMPOSITION));}if (!SetPixelFormat(device_context,PixelFormat,&pfd)){error_code = ERR_PFD_SET_FAILED;ReleaseDC(window,device_context);device_context = NULL;GL_ENDreturn false;}gl_context = wglCreateContext(device_context);if (!gl_context){error_code = ERR_CONTEXT_CREATION_FAILED;ReleaseDC(window,device_context);device_context = NULL;GL_ENDreturn false;}if (!wglMakeCurrent(device_context,gl_context)){wglDeleteContext(gl_context);ReleaseDC(window,device_context);gl_context = NULL;device_context = NULL;error_code = ERR_CONTEXT_BINDING_FAILED;GL_ENDreturn false;}GetClientRect(hWnd, &Screen);window = hWnd;gl_extensions.initialize(device_context);initDefaultExtensions();if (wglSwapInterval)wglSwapInterval(config.vertical_sync);initGL();if (error_code != ERR_NO_ERROR){wglDeleteContext(gl_context);ReleaseDC(window,device_context);device_context = NULL;gl_context = NULL;}GL_ENDreturn error_code == ERR_NO_ERROR;;Following the chicken-egg-problem i create a window, bind a context to it, retrieve the wglChoosePixelFormat(ARB) function, destroy both window and context, then repeat.The method doing that is:while (true){HWND hWnd = context.createWindow(window_name,hide_border,icon_filename);if (!hWnd){context_error = true;return false;}if (!GL::createContext(hWnd,config)){context.destroyWindow();if (GL::getErrorCode() == ERR_RETRY)continue;context_error = false;return false;}const RECT&window = context.windowLocation();GL::setRegion(rect(0,0,window.right-window.left,window.bottom-window.top));pixel_aspect = context.pixelAspectf();region_size = context.clientSize();return true;}Finally my window event function looks like this:LRESULT CALLBACK CContext::WndProc(HWND hWnd, UINT Msg, WPARAM wParam,LPARAM lParam){#ifndef WM_XBUTTONDOWN#define WM_XBUTTONDOWN 523#endif#ifndef WM_XBUTTONUP#define WM_XBUTTONUP 524#endif#ifndef VK_XBUTTON1#define VK_XBUTTON1 5#endif#ifndef VK_XBUTTON2#define VK_XBUTTON2 6#endifswitch (Msg){case WM_ERASEBKGND: return 1;case WM_SETFOCUS:   context.restoreFocus();return 0;case WM_KILLFOCUS:  context.looseFocus();return 0;case WM_SYSKEYDOWN:case WM_KEYDOWN:keyboard.keyDown((Key::Name)wParam);return 0;case WM_SYSKEYUP:case WM_KEYUP:keyboard.keyUp((Key::Name)wParam);return 0;case WM_CHAR:keyboard.input(wParam);return 0;case WM_LBUTTONDOWN:mouse.buttonDown(0); installHook();return 0;case WM_LBUTTONUP:  mouse.buttonUp(0);return 0;case WM_MBUTTONDOWN:mouse.buttonDown(1); installHook();return 0;case WM_MBUTTONUP:  mouse.buttonUp(1);return 0;case WM_RBUTTONDOWN:mouse.buttonDown(2); installHook();return 0;case WM_RBUTTONUP:  mouse.buttonUp(2);return 0;case WM_XBUTTONDOWN://cout << wParam<<" / "<<HIWORD (wParam)<<" == "<<VK_XBUTTON1<<endl;mouse.buttonDown(HIWORD (wParam)==1?3:4); installHook();return 0;case WM_XBUTTONUP:mouse.buttonUp(HIWORD (wParam)==1?3:4);return 0;case WM_MOUSEWHEEL: if (mouse.wheel_link) mouse.wheel_link(GET_WHEEL_DELTA_WPARAM(wParam));return 0;case WM_MOVE:{WINDOWINFOinfo;if (GetWindowInfo(context.hWnd,&info)){context._location = info.rcWindow;context.client_area = info.rcClient;mouse.redefineWindow(context.client_area);}}break;case WM_DESTROY:case WM_CLOSE:  context.eventClose();   return 0;default:return DefWindowProc(hWnd, Msg, wParam, lParam);}return DefWindowProc(hWnd,Msg,wParam,lParam);}I've been experimenting all morning. So far no luck but there's quite a couple switches to try.Edit:On the plus side i get to finally clean up some things a bit sub-optimal here. On the minus side ... it doesn't fix the issue :P   