Original Post
It's these annoying swap chains again. I've been trying to get it to render to multiple windows but it's just not working. I can setup two windows and two swap chains with depth buffers and all. But it will only draw to the second window (Second meaning the second one to be created and therefore the second one that gets drawn to). The first window just shows a bright green colour. What I do is I make a swap chain the render target, draw things, then go and make the next swap chain the render target, draw etc. Once all of them have been done I Present them all. I think this is where I am going wrong. Do I need to draw to one render target, present it THEN do another? Setting the render target: Presenting them all: Another odd problem is that when (trying to) render to multiple windows if I resize the window over a certain size nothing is drawn. it just clears it and that's all. I seem to be able to stretch it horizontally as far as I want but if I stretch it too much vertically it just disappears. I've checked all the backbuffer widths and viewport settings and I can't see anything wrong. What usually causes this behavior :S
f(FAILED(m_swapChains.at(targetNum)->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &backBuffer)))
return;
m_d3d9Device->SetRenderTarget(0, backBuffer);
//backBuffer->Release();
D3DPRESENT_PARAMETERS pp;
m_swapChains.at(targetNum)->GetPresentParameters(&pp);
if(FAILED(m_d3d9Device->SetDepthStencilSurface(m_depthStencilBuffers.at(targetNum))))
return;
//Clear(false, true, true);
viewport.X = 0;
viewport.Y = 0;
viewport.Width = pp.BackBufferWidth;
viewport.Height = pp.BackBufferHeight;
viewport.MinZ = 0.0f;
viewport.MaxZ = 1.0f;
m_d3d9Device->SetViewport(&viewport);
m_activeWindow = pp.hDeviceWindow;
m_activeSwapChain = targetNum;
m_d3d9PP = pp;
void D3D9RenderDevice::Present()
{
for(int i = 0; i < m_numSwapChains; i++)
{
D3DPRESENT_PARAMETERS pp;
m_swapChains.at(i)->GetPresentParameters(&pp);
m_swapChains.at(i)->Present(NULL, NULL, pp.hDeviceWindow, NULL, 0);
}
}