Sign in to follow this  

DirectX10 Fullscreen sample?

Recommended Posts

Everywhere online I find how to go to fullscreen using either alt+enter or use Swapchain->FullscreenState(true,NULL). As it is, when I do this, I get big black borders on the screen and the viewport is only a part of the entire screen. How can I go fullscreen and change the display resolution of the monitor to match the client area of my window? Thanks in advance.

Share this post

Link to post
Share on other sites
To enable resolution switching, use the DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH for DXGI_SWAP_CHAIN_DESC::Flags when creating your swap-chain. Also use this flag for IDXGISwapChain::ResizeBuffers, which you should be using on WM_SIZE messages to resize the back-buffer. If the monitor doesn't support exactly the resolution of your client area, the resolution you actually get might be different, and always resize your buffers to match exactly the resolution whenever possible. You can use the IDXGISwapChain::ResizeTarget to set the screen-resolution, when using the flag to allow mode switch and fullscreen mode (in windowed mode this will change the window size instead). It's best to enumerate available modes for the display, and pass one of them to ResizeTarget, instead of relying on a pre-defined one that happens to work on your computer.

Share this post

Link to post
Share on other sites
That's pretty much what I'm doing at the moment but I'm still getting those borders.

// Resize the swap chain and recreate the render target view.
1, DXWINDOW->GetWidth(),

DXGI_MODE_DESC requestedMode;
requestedMode.Width = DXWINDOW->GetWidth();
requestedMode.Height = DXWINDOW->GetHeight();
requestedMode.RefreshRate.Numerator = 60;
requestedMode.RefreshRate.Denominator = 1;
requestedMode.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
requestedMode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
requestedMode.Scaling = DXGI_MODE_SCALING_STRETCHED;


if (DXWINDOW->GetFullScreen())

Share this post

Link to post
Share on other sites
What do you mean with borders?
Do they show up in a screenshot?
Might just be the monitor that isn't calibrated. I would use ResizeBuffers after ResizeTarget though, unless you already do that in WM_SIZE.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this