Sign in to follow this  

Problems useing swapchains

This topic is 3316 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 everyone, i am trying to render into 4 different Windows useing swapchains but somehow its not working:-( Maybe someone could look at my code and tell me if i am doing something obvious wrong. Creating the Windows: hWnd3D[i] = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("static"), NULL, WS_CHILD | SS_BLACKRECT | WS_VISIBLE, x, y, rcWnd.right/2-20, rcWnd.bottom/2-20, g_hWnd, NULL, g_hInst, NULL); Creating the swap chains: m_d3dpp.hDeviceWindow = m_hWnd[i]; m_pDevice->CreateAdditionalSwapChain(&m_d3dpp, &m_pChain[i]); Picking a window to render to: HRESULT FBSDeviceD3D::useWindow(UINT nHwnd){ LPDIRECT3DSURFACE9 pBack = NULL; if(!m_d3dpp.Windowed){ return FBS_OK; } else if(nHwnd >= m_nNumWnd) return FBS_FAIL; //try to get the appropriate back buffer if(FAILED(m_pChain[nHwnd]->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pBack))) return FBS_FAIL; //actuave the back buffer for the device m_pDevice->SetRenderTarget(0, pBack); pBack->Release(); m_nActivehWnd = nHwnd; return FBS_OK; } Thx a lot in advance for any hints you guy smight have.

Share this post


Link to post
Share on other sites
Quote:
Original post by Roziks_World
Hi everyone,

i am trying to render into 4 different Windows useing swapchains but somehow its not working:-(
Define "not working". Does it crash? Does it render nothing? Any output from the Debug Runtimes?

Share this post


Link to post
Share on other sites
Well if i dont use the "useWindow" function at all it renders into the first window.

If i use the useWindow function to set the render window i get 4 black windows and nothing is rendered even when i set it to the first window.

Its not crashing its just not rendering anything.

Here is my Post Render function:

indBool FBSDeviceD3D::postRender(){
m_pDevice->EndScene();
m_pDevice->Present(NULL, NULL, NULL, NULL);
m_bIsSceneRunning = false;
return true;
}//postRender

Share this post


Link to post
Share on other sites
Nevermind :-)

Just found the problem :-)

Changed my postRender function to this:

indBool FBSDeviceD3D::postRender(){
m_pDevice->EndScene();

if (m_pEnum->m_Windowed && ( m_nNumWnd > 0) ) {
if (FAILED(m_pChain[m_nActivehWnd]->Present(NULL, NULL, NULL, NULL, 0)))
FBSLogger::Instance()->log("FBSDeviceD3D", "error: Chain->Present() from EndRendering() failed", FBSLogger::Instance()->LOG_ERROR);
}
else {
if (FAILED(m_pDevice->Present(NULL, NULL, NULL, NULL)))
FBSLogger::Instance()->log("FBSDeviceD3D", "error: Deviec->Present() from EndRendering() failed", FBSLogger::Instance()->LOG_ERROR);
}

m_bIsSceneRunning = false;
return true;
}//postRender

Share this post


Link to post
Share on other sites

This topic is 3316 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.

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