Jump to content
  • Advertisement
Sign in to follow this  

Problem with screenshots

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

Hello, I have an issue with making screenshots. If my app is running fullscreen and I press the printscreen-key, the resulting picture often is purely green/pink. If make a screenshot myself like this,
D3DXSaveSurfaceToFile("screen.bmp", D3DXIFF_BMP, pRenderSurface, 0, 0);

it actually depends where I place this line. I understand it would not be wise to make a screenshot directly after a call to Clear() but that is not what I do. I only get proper screenshots if I run the above code before a call to Present(), and that is what I don't understand. Present() does not make anything green/pink, does it?

Share this post

Link to post
Share on other sites
The green/pink part is from the debug runtimes - it's a special "code" that indicates an unused/uncleared buffer. You'll get it in other places as well - iirc, don't clear your render target and present it to the screen and you'll get a mucky pink/green mess [lol]

Normally you'd want to take a snapshot after the present operation as you'll get a properly anti-aliased image (if thats what you want) from the front buffer.

Two things:

1. What's your discard/presentation-parameters configuration?

2. What's your code for retrieving the image from the display? are you using GetRenderTargetData(), GetFrontBuffer() or GetBackBuffer()?


Share this post

Link to post
Share on other sites
Well, actually I was using something like this:

IDirect3DSurface9* pRenderSurface = 0;
GetRenderTarget(0, &pRenderSurface);

Never thought about GetBackBuffer().
Changing the present/discard config did not matter I believe.


What msdn has to say about GetFrontBufferData():
"This method is the only way to capture an antialiased screen shot."

I guess that is what I want. :)

Share this post

Link to post
Share on other sites
I tried this:

IDirect3DSurface9* pFrontBuffer = 0;
IDirect3DTexture9* pTexture = 0;

pD3DDevice->CreateTexture(Width, Height,
&pTexture, 0) ;
pTexture->GetSurfaceLevel(0, &pFrontBuffer);

pD3DDevice->GetFrontBufferData(0, pFrontBuffer);

D3DXSaveSurfaceToFile("screen.bmp", D3DXIFF_BMP, pFrontBuffer , 0, 0);


And got this:
"Destination surface must be in system or scratch memory. GetFrontBufferData fails."

Any idea?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!