DX10: Problem with two swapchains

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

Recommended Posts

Hi! I've created two swapchains in my programm. One for the main viewport and one for a small preview. The problem is, that when I resize the Main Window, the meshes in the Preview window are changing their sizes, too! The first chain is created by DXUT. The second by myself. This is the code for the second one:
void DXSubWindows::Init(LPWSTR DLGResource,HWND Viewport,DLGPROC Proc,DX10Scene* Scene)
{
if(DLGResource)
{
Window=CreateDialog( DXUTGetHINSTANCE(), DLGResource, NULL,(DLGPROC)Proc);
}
bIsOpen=true;
TheScene=Scene;
DXGI_SWAP_CHAIN_DESC Desc;
DXGI_SWAP_CHAIN_DESC swapChainDesc;

DXUTGetDXGISwapChain()->GetDesc(&Desc);

Desc.OutputWindow=Viewport;

RECT s;
GetClientRect(Viewport,&s);

Format=Desc.BufferDesc.Format;

swapChainDesc.BufferDesc.Width=s.right;
swapChainDesc.BufferDesc.Height=s.bottom;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
swapChainDesc.BufferDesc.Format = Desc.BufferDesc.Format;
swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 1;
swapChainDesc.OutputWindow = Viewport;
swapChainDesc.Windowed = 1;
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

DXUTGetDXGIFactory()->CreateSwapChain(DXUTGetD3D10Device(),&swapChainDesc,&SwapChain);

CreateBuffers();
OnResizedChain();

}

[Edited by - WuTz on February 14, 2010 10:57:09 AM]