Change Screen Res During Execution

Started by
11 comments, last by Buckeye 15 years, 9 months ago
Quote:In fullscreen mode, you don't need to resize the window to match D3D's size, but you will in windowed mode.

If your run loop has a good ResetDevice() routine, you don't have do anything in windowed mode or full screen.
if( bWindowed ) {	m_PresentParameters.Windowed = TRUE;	m_PresentParameters.BackBufferWidth = windowClientWidth;	m_PresentParameters.BackBufferHeight = windowClientHeight;        ...} else {	//Find out desktop resolution:	D3DDISPLAYMODE DisplayMode;	m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &DisplayMode);	//set fullscreen parameters	m_PresentParameters.BackBufferFormat = D3DFMT_A8R8G8B8;	m_PresentParameters.Windowed = FALSE;        m_PresentParameters.BackBufferWidth = DisplayMode.Width;        m_PresentParameters.BackBufferHeight = DisplayMode.Height;        ...}

EDIT: IMHO, in windowed mode, the window belongs to the user and if he wants to resize it, that's up to him.

A recalculation of fAspect should be done in any case and that should take care of the presentation in most apps.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Advertisement
Quote:Original post by Evil Steve
Quote:Original post by Mike nl
Quote:Original post by Evil Steve
In fullscreen mode, you don't need to resize the window to match D3D's size, but you will in windowed mode.

Well, you don't have to, but then the backbuffer will get squeezed or stretched in the mismatched sized window.
Are you sure? I've not seen this happening - I thought D3D changes the display mode to suit, and ignores the window size.

It's probably still a good idea to resize the window anyway, just to keep fullscreen and windowed mode code the same.


I'm talking about windowed mode, just so we're clear. If you Reset() with a BackBufferWidth and Height different than the window size, it will stretch the backbuffer on the window. Of course, using 0 for both is easy and will ensure a perfect fit. But nothing DirectX does seem capable of resizing the window.

And I don't think the window size matters in full-screen mode.
Million-to-one chances occur nine times out of ten!
Quote:If you Reset() with a BackBufferWidth and Height different than the window size..

That's a true statement, but.. why would you do that?

Even if the screen resolution changes, the window size in pixels remains that same unless the screen resolution is smaller than the window size.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement