I'm trying to make the backbuffer get resized when the window gets resized.Here's the code:
case WM_SIZE:
int mClientWidth = LOWORD(lParam);
int mClientHeight = HIWORD(lParam);
g_engine->setScreenHeight(mClientHeight);
g_engine->setScreenWidth(mClientWidth);
if(g_engine->p_device){
D3DDISPLAYMODE dm;
g_engine->p_d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &dm);
D3DPRESENT_PARAMETERS pa;
pa.Windowed = true;
pa.hDeviceWindow = g_engine->getWindowHandle();
pa.SwapEffect = D3DSWAPEFFECT_DISCARD;
pa.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
pa.BackBufferFormat = dm.Format;
pa.BackBufferCount = 1;
pa.MultiSampleType = D3DMULTISAMPLE_NONE;
pa.MultiSampleQuality = 0;
pa.EnableAutoDepthStencil = true;
pa.AutoDepthStencilFormat = D3DFMT_D16;
pa.FullScreen_RefreshRateInHz = 0;
pa.BackBufferWidth = mClientWidth;
pa.BackBufferHeight = mClientHeight;
g_engine->p_device->Reset(&pa);
}
break;
}
I can't understand what's wrong!