Capture the screenshot!

Started by
16 comments, last by Jan Birsa 15 years, 2 months ago
Quote:Original post by MJP
If you want you can just call IDirect3DDevice9::GetBackBuffer and pass that surface to D3DXSaveSurfaceToFile.


Hum thanks, I was reading this post, implemented those 2 lines of code, and now I have screen shot ability in our engine !
Advertisement
Quote:Original post by Jan Birsa
What should I do? Whats the problem?

Try to turn off atnialiasing:)
Quote:Original post by Evil Steve
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.


Sorry, but I am soo stupid...I forgot to compile as debug and thats why I aint got anything.

Now, bingo:
Direct3D9: (ERROR) :Destination surface not big enough to hold the size of the screen. GetFrontBufferData fails.
D3D9 Helper: IDirect3DDevice9::GetFrontBufferData failed: D3DERR_INVALIDCALL

Quote:Original post by Jan Birsa
Quote:Original post by Evil Steve
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.


Sorry, but I am soo stupid...I forgot to compile as debug and thats why I aint got anything.

Now, bingo:
Direct3D9: (ERROR) :Destination surface not big enough to hold the size of the screen. GetFrontBufferData fails.
D3D9 Helper: IDirect3DDevice9::GetFrontBufferData failed: D3DERR_INVALIDCALL


Oh, thank you so much for help. I guess I should run debugs more often (now I learned how to do it).

All I had to do is store dimensions of surface to width and height variable, and use both for fetching (CreateOffscreenPlainSurface and GetFrontBufferData) buffer data.

Yet one funny thing Ive noticed. If I set size manually for example 2000x2000 it captures everything (app + windows). Maybe because of Vista's Areo or something?

Ok, I have another problem (this is because I am a n00b).

I have made 2 UINT variables, height and width where I store my height and width from pBackBufferSurfaceDesc.

It stores everything fine, but it fails to make a screenshot in windowed mode.
For some reason, it want to make a screenshot of whole desktop (display resolution), which is 1680x1050, but in pBackBufferSurfaceDesc I have 1024x786, and screenshot fails to make (black screen).

If I go fullscreen for example 640x480, it makes screenshot just fine, since in fullscreen display resolution changes to same as applications one.

What the hell am I doing wrong this time?
I have a question regarding the rights of using an image format to capture screenshot in comercial applications. Can I use JPG or BMP to save screenshots on a commercial application??, because I remember that even Microsoft had a problem with this ( http://yro.slashdot.org/yro/05/04/24/1228234.shtml?tid=123&tid=109&tid=188&tid=95 )
I'm using DirectX, winXP.

Saludos
thanks ...
no idea LOL

This topic is closed to new replies.

Advertisement