Jump to content
  • Advertisement
Sign in to follow this  

Mesh not displaying correctly. 4 swap chains used

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


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:

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

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!