Jump to content
  • Advertisement
Sign in to follow this  
Roof Top Pew Wee

[C#, MDX] Screenshot code works in Release, pink file in debug. SOLVED

This topic is 4558 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'm a little confuses as to why the following code works perfectly when Direct3D is in release mode, but not when in debug:
            Surface backbuffer = device.GetBackBuffer(0, 0, BackBufferType.Mono);
            SurfaceLoader.Save(fileName, ImageFileFormat.Jpg, backbuffer);
            backbuffer.Dispose();

The backbuffer is retrieved either way because the image saved matches the dimensions of my window, but when I switch the D3D Runtime to the Debug Version, I just get a pink screen. I've looked around for info on this, but haven't been able to find anything on Google/Docs/books. Any pointers? --Vic-- [Edited by - Roof Top Pew Wee on April 1, 2006 4:21:33 PM]

Share this post


Link to post
Share on other sites
Advertisement
You're calling that code before you render you scene, or after you call Present(), aren't you?

The debug runtime clears the backbuffer to alternating magenta and green each frame, so you can see if you forgot to clear the backbuffer or any other problems. There's no guarantee that what you have on the backbuffer in one frame will stay there for the next. Just because it works on your card doesn't mean it'll always work. This is a warning from D3D.

What's happening is you're probably rendering your scene, then calling Present(), which swaps the buffers. The debug runtime now fills the backbuffer with either magenta or green. You then grab the backbuffer and save it to a file. Result: A pink or green screenshot.

Moving the code you have to just before Present() should fix that problem I think.

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!