티스토리 뷰

We can use 'ID3DXRenderToSurface' or 'IDirect3DSurface9" for Post Processing. but ID3DXRenderToSurface is slower than IDirect3DSurface9.

//복구를 위해 저장해 둠.
IDirect3DSurface9* pOldRT;
gd3dDevice->GetRenderTarget(0, &pOldRT);

//생성되어 있는 _pTarget(IDirect3DTexture9)의 surface를 얻어옴.
IDirect3DSurface9
* pTargetSurf;
HR(_pTarget->GetSurfaceLevel(0, &pTargetSurf));
//렌더타켓 설정(_pTarget위에 그려지게됨)
gd3dDevice->SetRenderTarget(0, pTargetSurf);

HR(gd3dDevice->Clear( 0,  0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL,  0xff778899, 1.0f,  0));
HR(gd3dDevice->BeginScene());
{
    //렌더링
}
HR(gd3dDevice->EndScene());
ReleaseCOM(pTargetSurf);

//렌더타겟 복구.
gd3dDevice->SetRenderTarget(0, pOldRT);
ReleaseCOM(pOldRT);

'Computer > Graphics' 카테고리의 다른 글

asdffffev  (0) 2010.01.12
NPR Line Drawing  (0) 2010.01.10
ID3DXRenderToSurface, IDirect3DSurface9  (0) 2009.04.17
수묵화렌더링  (0) 2008.12.13
Motion Blur?  (0) 2008.12.05
수묵화 렌더링(?)  (0) 2008.11.02
댓글
Total
168,077
Today
10
Yesterday
34