asking a question about D3DPRESENT_PARAMETERS

Started by
1 comment, last by longlong9 9 years, 11 months ago

hello everyone?i trouble with a question like the picture?

the right is render correct ? the left is not render correct?

can anyone konw what's wrong?

the code?

3DPRESENT_PARAMETERS d3dpp;

ZeroMemory( &d3dpp, sizeof(d3dpp) );

d3dpp.Windowed = TRUE;

d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

D3DDISPLAYMODE mode; if(FAILED(g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT , &mode))) {

return 0;

}

d3dpp.BackBufferFormat = mode.Format;

d3dpp.hDeviceWindow = (HWND)m_hWnd; d3dpp.EnableAutoDepthStencil = TRUE;

d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

if(g_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,

mode.Format,FALSE,D3DMULTISAMPLE_4_SAMPLES, NULL) == D3D_OK)

{

d3dpp.MultiSampleType = D3DMULTISAMPLE_4_SAMPLES;

}

else

{

d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;

}

d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;

}

if(FAILED(s_pD3DDevice->CreateAdditionalSwapChain(&d3dpp, &m_pSwapChain)))

{

return 0;

}

if i use d3dpp.MultiSampleType = D3DMULTISAMPLE_4_SAMPLES; the picture render well be the left.

if i use d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE; the picture render well be the right.

the render code:

IDirect3DSurface9 * pBackBuffer = NULL;
if (NULL != m_pSwapChain)
{
m_pSwapChain->GetBackBuffer(0,D3DBACKBUFFER_TYPE_MONO,&pBackBuffer);
}
m_pD3DDevice->SetRenderTarget(0 , pBackBuffer);

m_pD3DDevice->StretchRect(m_pSurface,pRectSrc,m_pBackSurface,NULL,D3DTEXF_LINEAR);

hr = m_pSwapChain->Present(NULL, NULL, (HWND)hWnd, NULL,0 );
if (FAILED(hr))
{
return 0;
}

Advertisement
According to the documentation, StretchRect can be used to copy from - but not to - a multisampled render target.

Sean Middleditch – Game Systems Engineer – Join my team!

thanks

This topic is closed to new replies.

Advertisement