Sign in to follow this  
Dissipate

Exit fullscreen - window displays non contained resolution

Recommended Posts

Dissipate    483

Hi,

 

My lost device checks are all fine but when I exit fullscreen and go into windowed mode the window does not contain the entirety of the display. Starting in windowed format is ok. It displays the 1920x1080 display in a 1280x720 window, which is what I want to happen when it exits fullscreen as well. What am I doing wrong?  I stopped changing m_D3DPP.BackBufferWidth and height within WM_EXITSIZEMOVE and WM_SIZE because when I moved the window it would change the display in this way.

 

Here is how I am window-a-fying:

 

RECT ClientRect = {0, 0, WINDOWED_WIDTH, WINDOWED_HEIGHT};
AdjustWindowRect(&ClientRect, WS_OVERLAPPEDWINDOW, false);
m_D3DPP.BackBufferFormat = D3DFMT_UNKNOWN;
m_D3DPP.BackBufferWidth  = WINDOWED_WIDTH;
m_D3DPP.BackBufferHeight = WINDOWED_HEIGHT;
m_D3DPP.Windowed         = true;

SetWindowLongPtr(m_hWindow, GWL_STYLE, WS_OVERLAPPEDWINDOW);

SetWindowPos(m_hWindow, HWND_TOP, 
			100, 100, 
			ClientRect.right, ClientRect.bottom, 
			SWP_NOZORDER | SWP_SHOWWINDOW);

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites
Amr0    2230

Try using SWP_FRAMECHANGED with SetWindowPos. Also, what do you mean it doesn't contain the entirety of the display? Is the rendered image cropped or stretched? Are you messing around with viewports? Do you properly update the camera's projection matrix to compensate for the size change? Check, say, when the mouse is clicked, that the back buffer size matches the client area size after coming out of fullscreen.

Share this post


Link to post
Share on other sites
Dissipate    483

Thanks for you reply...

Try using SWP_FRAMECHANGED with SetWindowPos.

Didn't work. No change.

Also, what do you mean it doesn't contain the entirety of the display?

When exiting fullscreen the window displays cropped tiled image. The top left of the background which extends right and down beyond the window which is 1280x720. So the backbuffer must be 1920x1080.

Is the rendered image cropped or stretched?

Not stretched in anyway. Just cropped.

Are you messing around with viewports?

No. I did read somewhere on MSDN about viewport but I'm unsure how to implement them. I had a go and failed.

Do you properly update the camera's projection matrix to compensate for the size change?

If I use my Camera->Update() to set the projection and view it does work fine (I just plug the same old numbers in). But, Im trying to create a 2D game and I dont bother calling it in the reder loop or anywhere else. This draws the tiles absolutely rather than relative.

Check, say, when the mouse is clicked, that the back buffer size matches the client area size after coming out of fullscreen.

***Solved*** (Sigh...) I was setting the backbuffer to the windowed_width&height along with the ClientRect. Changed it to fullscreen_width&height and it works like a charm. (althought I dont believe in charms!...)

 

Thank you for giving me guiding me to the answer. May many doughnuts come your way...!

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