DX10: Problem with two swapchains

Started by
-1 comments, last by WuTz 14 years, 2 months ago
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.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
    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]

This topic is closed to new replies.

Advertisement