• Advertisement
Sign in to follow this  

Screenshots in DirectX 9

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

How do I save the contents of the frame buffer to a file (BMP, JPG, etc.)? There is a great little sample on how to do this in DX 8 but some of the interfaces were discontinued in DX 9. Thanks...

Share this post


Link to post
Share on other sites
Advertisement
It's really easy [smile]. Just get the current rendertarget (the backbuffer), and write the surface to file, using D3DX.


LPDIRECT3DSURFACE9 pSurf;
pd3dDevice->GetRenderTarget( 0, &pSurf );

D3DXSaveSurfaceToFile( L"screenshot.bmp", D3DXIFF_BMP, pSurf, NULL, NULL );
pSurf->Release();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement