Sign in to follow this  
Jan Birsa

Screenshot problem

Recommended Posts

I am trying to make a screenshot in C++ DX9 using DXUT, but I have some problems. I have fixed one already. The device didn't work as it should, I fixed that, and now device isn't NULL anymore. It makes screenshot, but the problem is, its black. I get something.bmp, but its black, which is another frustrating problem I have. I guess there is something wrong with surface... Here is the code: HRESULT WINAPI CaptureScreen(IDirect3DDevice9* pd3dDevice) { IDirect3DSurface9* pSurface; //IDirect3DDevice9 *pd3dDevice = DXUTGetD3D9Device(); if (pd3dDevice != NULL) { //DXUTShutdown( 0 ); //proof device isnt NULL pd3dDevice->CreateOffscreenPlainSurface(1024, 768, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL); pd3dDevice->GetFrontBufferData(0, pSurface); } D3DXSaveSurfaceToFile(L"Media\\Screenshots\\something.bmp",D3DXIFF_BMP,pSurface,NULL,NULL); pSurface->Release(); return 0; }

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this