Jump to content
  • Advertisement
Sign in to follow this  
Jan Birsa

Capture the screenshot!

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

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; } What should I do? Whats the problem?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Demirug
I am pretty sre that the surface needs to be created in system memory pool and not in the scratch pool.

SYSTEMMEM pool didnt make any difference...

Share this post


Link to post
Share on other sites
Quote:
Original post by Jan Birsa
Quote:
Original post by Demirug
I am pretty sre that the surface needs to be created in system memory pool and not in the scratch pool.

SYSTEMMEM pool didnt make any difference...
And what did the debug runtimes say when you used the system memory pool?

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by Jan Birsa
Quote:
Original post by Demirug
I am pretty sre that the surface needs to be created in system memory pool and not in the scratch pool.

SYSTEMMEM pool didnt make any difference...
And what did the debug runtimes say when you used the system memory pool?


When I run debug with breakpoints set I get here:
pd3dDevice->GetFrontBufferData(0, pSurface); red marked 0x04915500 on d3dx9.lib and 0x049c5600 on d3dx9d.lib. I have set debug on max in DX Cpanel for this run.



Share this post


Link to post
Share on other sites
Quote:
Original post by Jan Birsa
When I run debug with breakpoints set I get here:
pd3dDevice->GetFrontBufferData(0, pSurface); red marked 0x04915500 on d3dx9.lib and 0x049c5600 on d3dx9d.lib. I have set debug on max in DX Cpanel for this run.
Don't use any breakpoints on the DirectX control panel, just let the code run (and render black), and look at the debug output.

Even with "break on D3D error" enabled, you should still get some debug output.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jan Birsa
Quote:
Original post by Evil Steve
Quote:
Original post by Jan Birsa
Quote:
Original post by Demirug
I am pretty sre that the surface needs to be created in system memory pool and not in the scratch pool.

SYSTEMMEM pool didnt make any difference...
And what did the debug runtimes say when you used the system memory pool?


When I run debug with breakpoints set I get here:
pd3dDevice->GetFrontBufferData(0, pSurface); red marked 0x04915500 on d3dx9.lib and 0x049c5600 on d3dx9d.lib. I have set debug on max in DX Cpanel for this run.


What am I doing wrong?

Share this post


Link to post
Share on other sites
Quote:
Original post by Jan Birsa
Quote:
Original post by Jan Birsa
When I run debug with breakpoints set I get here:
pd3dDevice->GetFrontBufferData(0, pSurface); red marked 0x04915500 on d3dx9.lib and 0x049c5600 on d3dx9d.lib. I have set debug on max in DX Cpanel for this run.


What am I doing wrong?
You're not looking at the debug output window. Can you paste the entire contents of the debug output window here when you get to that line?

If you don't know how to do that, I'd recommend This Article.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!