Jump to content

  • Log In with Google      Sign In   
  • Create Account


milaoshu1982

Member Since 24 Dec 2010
Offline Last Active May 27 2014 07:16 PM

Topics I've Started

asking a question about D3DPRESENT_PARAMETERS

12 May 2014 - 06:50 PM

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

 

 


how to set the line width

12 April 2014 - 12:58 AM

in d3d9's surface i draw lines use DrawPrimitive and D3DPT_LINELIST,because it is fact than gdi and ID3DXLine,but how to set the line width?

is anyone know? thanks.


why GDI is faster then ID3DXLine when drawing lines

09 April 2014 - 05:35 AM

hello everyone !  i use GDI and ID3DXLine to Draw lines in the D3Dsurface ,GDI

is not GPU accelerate,why faster then ID3DXLine? is anyone know why?


about reset and swanchain

15 January 2014 - 11:45 PM

hello,i have a problem.

 

how did reset function work to swapchain.

 

when i have one swapchain , i will reset the device when the window's size is changed.

 

but if i have two swapchain, each associate to one windows,and  just one window's size changed ,then i called reset ,will it work to another window?

 

is anyone know how to do ?


about SwapChains

15 January 2014 - 08:52 PM

hello,i have a problem.

 

i createdevice , then it will create  implicit swapchain, i call GetNumberOfSwapChains ,i get the num is  1, then i call CreateAdditionalSwapChain

 

then GetNumberOfSwapChains,i get the num also is 1.why it is not increase to  2??


PARTNERS