Sign in to follow this  
WuTz

DX10: Problem with two swapchains

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.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]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this