Jump to content

  • Log In with Google      Sign In   
  • Create Account

Exit fullscreen - window displays non contained resolution


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Dissipate   Members   -  Reputation: 377

Like
0Likes
Like

Posted 11 April 2013 - 08:06 AM

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.



Sponsor:

#2 Amr0   Members   -  Reputation: 1154

Like
0Likes
Like

Posted 11 April 2013 - 01:28 PM

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.



#3 Dissipate   Members   -  Reputation: 377

Like
0Likes
Like

Posted 11 April 2013 - 02:24 PM

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...!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS