D3D Export

 

1 D3DDISPLAYMODE d3ddm;
2 pD3D9->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm);
3 IDirect3DSurface9* pD3DSurfTemp;
4 hr = pD3D9Device->CreateOffscreenPlainSurface(m_dwD3DWidth, m_dwD3DHeight, d3ddm.Format, D3DPOOL_SYSTEMMEM, &pD3DSurfTemp, NULL);
5 hr = pD3DDevice->GetRenderTargetData(m_pRenderTarget, pD3DSurfTemp);
6
7 D3DLOCKED_RECT lockRect = {0};
8  if (SUCCEEDED(pD3DSurfTemp->LockRect(&lockRect, NULL, 0)))
9 {
10 ...
11   pD3DSurfTemp->UnlockRect();
12 }

 

从离屏缓冲pD3DSurfTemp上Lock数据要比直接从m_pRenderTarget快很多

 

posted @ 2010-05-12 14:19  芈希有  阅读(336)  评论(0编辑  收藏  举报