Switching to fullscreen in DirectX

Started by
4 comments, last by RajanSky 21 years, 7 months ago
Hi, I was wondering if anyone knows how to switch to fullscreen mode *while* a game is running? I know you can pass in the "Windowed" parameter from the D3DDISPLAYMODE structure to the CreateDevice() function, but it wouldn''t really make sense to call createDevice in the middle of a game! So does anyone know some function or technique to allow you to toggle between fullscreen and windowed? Thank you, Raj Sharma
Advertisement
You''d probably have to shutdown D3D, restart it in fullscreen mode, and reload everything.
I think the D3DDevice->Reset () method could do this, but you''d still have to reload everying. Video memory gets trashed if you change screen modes.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Thanks for the replies guys. Man, that sucks that you have to reset it! Oh well heh

Raj
you have to restore everything with d3d. Better you just quit your game and restart with fullscreen.

How do you reset the device, without losing memory everytime you switch back from Alt-Tab or Ctrl-ESC?

If you add the line:
Debug.Print "Memory available: " & D3DDevice.GetAvailableTextureMem(D3DPOOL_DEFAULT)
You can watch your memory being eaten away until there''s nothing left, and then the device can''t even be reset or created anymore!

This phenomenon can be emphasized by using this front & backbuffer format:
D3DFMT_X8R8G8B8

This only occurs if the fullscreen mode is the same as the desktop mode. It doesn''t occur if they are different color depths or resolutions.

Any ideas?

This topic is closed to new replies.

Advertisement