• Advertisement
Sign in to follow this  

How does one recreate the backbuffer in d3d 9?

This topic is 1800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Because I don't have experience with d3d9,I don't know how to do it.I tried msdn,but d3d9 is a little bit different from 10 and 11.

 

Anyway,if I have a pointer to a backbuffer,what's the proper way to resize it in d3d9?

BTW: If you could show me some actual code,it would help a lot!

Share this post


Link to post
Share on other sites
Advertisement
Whenever window gets resized, I usually take the following approach. This should work for you as well.
 
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
 
GetClientRect(winh, &winRect);
 
//Use winRect to calculate winHeight and winWidth.
 
if(!fullScreen)
{
d3dpp.Windowed = TRUE;
d3dpp.BackBufferHeight = winHeight;
d3dpp.BackBufferWidth = winWidth;
}
else
{
d3dpp.Windowed = FALSE;
d3dpp.BackBufferWidth = (LONG) ::GetSystemMetrics(SM_CXSCREEN);
d3dpp.BackBufferHeight = (LONG) ::GetSystemMetrics(SM_CYSCREEN);
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}

 

 

D3DDISPLAYMODE d3ddm;
pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);
pd3dpp->BackBufferFormat = d3ddm.Format;
 
// Call CreateDevice

Share this post


Link to post
Share on other sites

The "official" way to resize the back buffer is to call IDirect3DDevice9::Reset - you will probably also need to do a bunch of work before and after the Reset call - see the Remarks section in the link provided.

You will also need to delete all resources allocated with D3DPOOL_DEFAULT and reallocate them otherwise Reset will fail. Once you reset the device you will need to reallocate all the resources that were using D3DPOOL_DEFAULT. I hope this helps

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement