Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AndyOxfeld

OpenGL Alt-tabbing out of full-screen Win32 OpenGL games

This topic is 5937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I noticed that when I alt-tab out of my Win32 OpenGL game, the resolution stays at the game resolution, rather than automatically switching back to the user''s resolution. I am using the ChangeDisplaySettings() function to change the resolution. I tried putting ChangeDisplaySettings calls in response to the WM_ACTIVATEAPP event, like the code below. That works, except that when you switch back into the game, the viewport is shifted down a lot (and calling glViewport() again doesn''t help.) Here''s the code I tried: case WM_ACTIVATEAPP: IsActive = (BOOL)wParam; if (IsActive) { SetDisplayMode(resx, resy, resbpp); SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); } else { SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOSIZE | SWP_NOZORDER); ChangeDisplaySettings(NULL, 0); } break; If anyone can help, it would be greatly appreciated. Thank you. - Andy Oxfeld

Share this post


Link to post
Share on other sites
Advertisement
Just a wild guess but have you tried doing the same thing within the WM_PAINT message handler??

I believe in Windows when you activate an application, besides the WM_ACTIVATEAPP message, it should ALSO get the WM_PAINT message..

Maybe making IsActive a global variable will help as well..

Just a guess!

hth,

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!