Jump to content
  • Advertisement
Sign in to follow this  
WuTz

DX10: Problem with two swapchains

This topic is 3049 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

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!