Jump to content
  • Advertisement
Sign in to follow this  
longlong9

asking a question about D3DPRESENT_PARAMETERS

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

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;
  }

 

 

Share this post


Link to post
Share on other sites
Advertisement
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!