1
\$\begingroup\$

I'm now learning how to use directX (10 - 11), and i use materials from SDK samples, http://www.rastertek.com/ and http://takinginitiative.net/category/graphics-programming/directx-10-tutorials. But i find it suprising that none has explainded the transition between fullscreen and windowed. I also seached with google, in GameDevelopment and StackOverflow, but no result.

What i'm asking is explanation or full exaples for both Window and DirectX "classes".

Thanks for help.

\$\endgroup\$
-1
\$\begingroup\$

You can do this using the normal Windows API function ChangeDisplaySettings http://msdn.microsoft.com/en-us/library/windows/desktop/dd183411(v=vs.85).aspx

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Not with D3D10/11 - use IDXGISwapChain::SetFullscreenState instead. \$\endgroup\$ – Maximus Minimus Dec 24 '12 at 17:02
  • 1
    \$\begingroup\$ @mh01, I've used this tutorial rastertek.com/tutdx11.html and double checked the source code for this answer, any reason why you shouldn't use the Windows API functions? They seem to work fine when I test it. \$\endgroup\$ – Roy T. Dec 24 '12 at 17:45
  • 1
    \$\begingroup\$ Mostly because SetFullScreenState is the method documented by Microsoft: msdn.microsoft.com/en-us/library/windows/desktop/…. It's generally good to follow the documentation I think, and the documentation should take precedence over a tutorial. \$\endgroup\$ – Maximus Minimus Dec 24 '12 at 23:26
  • \$\begingroup\$ there is nothing against using both. if you start your app and don't have a DirectX context yet, a lot of 3D Applications use ChangeDisplaySettings right after the window has been created to go fullscreen, and as soon as a context is available use SetFullScreenState for further adjustements \$\endgroup\$ – cppanda Dec 25 '12 at 1:16
  • \$\begingroup\$ @cppanda so once you have a DirectX context ChangeDisplaySettings no longer works? Should you use mh01's solution once you've already have a DirectX context? (In that case I think his answer is indeed better) \$\endgroup\$ – Roy T. Dec 25 '12 at 9:55
1
\$\begingroup\$

It actually turned out even simpler, I just recreated the DirectX device (or reset it) using new presentation parameters (windowed = false).

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Doesn't recreating the DirectX device have negative affects (maybe losing track of what is in GPU memory, I'm not sure but someone might be). \$\endgroup\$ – Roy T. Dec 25 '12 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.