How to make screenshot and save it to HDD using C# & XNA, while running game in fullscreen mode?
The API was changed in XNA 4.0.
If you are running on the HiDef
profile (Xbox 360 and newer Windows machines), you can use GraphicsDevice.GetBackBufferData
.
To make saving that data easy, you could use put the output from that into a Texture2D.SetData
and then use SaveAsPng
or SaveAsJpeg
(this is slightly slower than it needs to be, because it also sends the data back to the GPU - but it is just so easy).
If you are using the Reach
profile, then you have to render your scene to a RenderTarget2D
. My answer here should give you a good starting point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With