• Content count

  • Joined

  • Last visited

Community Reputation

130 Neutral

About longlong9

  • Rank
  1. DirectX 9 SetRenderTarget

    save the back surface first,
  2. 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;   }    
  3. how to set the line width

    thanks for reply,   another question ,how to enhance the ID3DXLine's efficiency?
  4. 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.
  5. 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?
  6. the simplest way is ,use StretchRect the surface to the backsurface.
  7. u can pack as this  (float)((a << 256) / max_short) + ( (float)(b / max_short))
  8. 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 ?
  9. about SwapChains

    ok!  thanks!
  10. about SwapChains

    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??
  11. NVidia driver crash

    there will be another problem, for example, draw two picture to two different windows(different picture size  different window size),one 1280X720 and 0ne 704X576.if i use just one device,the backbuffer's size is fixed or just up to one window. how can i deal with this problem?
  12. NVidia driver crash

    thanks for the reply?i will try just one device?
  13. hello , when i use d3d9 to render video , i create many device (CreateDevice ) to render for each video,the num of device i have created may be upto 128. it can just success for 60 , then i will catch a expetion .then crash in nvidia driver. is anyone encounte this problem?
  14. i have tryed just do once,it is run.but i need render one frame to two window. so i must eglmakecurrent(display , null , null .....).when render one frame is end. and it is not happened in ios, it is odd