Sign in to follow this  
doug25

Mesh not displaying correctly. 4 swap chains used

Recommended Posts

Hello,

I have a program that displays four views(four windows), and a swap chain for each view to do 3d rendering. For some reason when I zoom in and out of a view, the meshes I have
in the scene do not fully display, i.e. sometimes parts of a mesh disappear. Any idea why this could be ? I thought it had something to do with the swap chains sharing a back buffer
and that changing the back buffer width and height would fix it but it seems that I was wrong. Why do parts of a mesh disappear? here an example of the ortho projection for the first view:

D3DXMatrixOrthoLH( &matProj1, ((float)windowwidth * -fZoom1),
((float)windowheight * -fZoom1), -100000.0f, 100000.0f);

Here are the present parameters used at direct3d initialization time:

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.BackBufferWidth = width;
d3dpp.BackBufferHeight = height;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = 0;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = hWnd1;
d3dpp.Windowed = windowed;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
d3dpp.Flags = 0;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

each swap chain uses these on creation

(*device)->GetSwapChain(0, &swapChain1);
(*device)->CreateAdditionalSwapChain(&d3dpp, &swapChain2);
(*device)->CreateAdditionalSwapChain(&d3dpp, &swapChain3);
(*device)->CreateAdditionalSwapChain(&d3dpp, &swapChain4);

please help, thankyou

Share this post


Link to post
Share on other sites
Hidden
Just out of curiosity why are you using 4 swap chains? Take a look at viewports, i'm sure this will be able to handle what your trying to achieve a lot better...
[url="http://msdn.microsoft.com/en-us/library/bb206341(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/bb206341(v=vs.85).aspx[/url]
[url="http://takinginitiative.net/2010/07/30/directx-10-tutorial-7-viewports/"]http://takinginitiative.net/2010/07/30/directx-10-tutorial-7-viewports/[/url]

Share this post


Link to post
When I first read about creating multiple views, the examples showed a method of using swap chains, and that's why I used swap chains but it turns out that I don't need them as you've now made me realize. However I'm still getting odd results. I'm getting slightly better results now that I've made the back buffer automatic by setting the width and height to zero in present parameters so it generates the back buffer independently of each window. So I think the problem is to do with the back buffer but it's hard to tell. when I make the back buffer smaller, the pixels are stretched in the windows and this makes the disappearing bits more visible if that makes sense because they are stretched but It's not perfect and I can't figure out the proper solution to stop bits of meshes disappearing.

The Meshes are fine when viewed from certain angles

For a top down ortho projection I have to make the projection values as follows:

D3DXVECTOR3 lookAt(0.0f,0.0f,0.0f);
D3DXVECTOR3 upDirection(0.0f,1.0f,0.0f);
D3DXVECTOR3 lookFrom = D3DXVECTOR3(0.00001f,1.0f,0.0f);

when the lookFrom is set to
lookFrom = D3DXVECTOR3(0.0f,1.0f,0.0f);
each mesh completely disappears

I don't know why ?

Any help will be appreciated

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