Get the size of the monitor (size of the viewport in full screen)

Started by
2 comments, last by Volgogradetzzz 9 years, 2 months ago

Greetings.

I saw a lot of questions about full screen with dx11. I read a lot, tried to code a lot, finally I managed how to do this. Almost. The last piece of puzzle for me (well, I hope that it's last smile.png ) is to how to handle resolutions in full screen. Suppose I have a list of predefined resolutions and I want to use the one user selected. I know how to do this for buffers/targets - I just need to call


swapChain->ResizeBuffers()

and create new render targets with specified size.

But one interesting thing - when I change from windowed to full screen I also need to setup a new viewport. And for this I need to know the full screen size. For example, user have monitor with size 2560x1440 but selected 800x600 resolution. I specify 800x600 as the desired size of swap chain (buffers), but the viewport should be 2560x1440. How to achieve this? Is there any d3d function?

Or I'm totally wrong and viewport should be 800x600 also?

Advertisement

Or I'm totally wrong and viewport should be 800x600 also?

This.
Quoted for truth.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

You don't really need to care about the desktop resolution of the display. If you let the user pick the resolution, then you can set your viewport to the size of your back buffer and everything will work fine. Typically either the display will upscale to its native output resolution, or the GPU driver will automatically upscale to the native resolution.

However for future reference, if you want to find out the desktop resolution of a particular monitor then you can use IDXGIOutput::GetDesc().

Thank you, guys. I mistakenly thought that viewport is actual window through which we can see our 3d graphics. Something like Windows's window. But it turned out that viewport coupled with render target. In my case render target's size is 800x600 and to fully display my target I need 800x600 viewport.

This topic is closed to new replies.

Advertisement