Tag Archives: screenshot xna

Saving Current Frame into an Image File XNA 4.0

This implementation will save current frame into an image file named “anImageFile.png” Put this code into your draw method. if (takeScreenshot) { Color[] colors = new Color[GraphicsDevice.Viewport.Width * GraphicsDevice.Viewport.Height]; GraphicsDevice.GetBackBufferData<Color>(colors); Texture2D tex2D = new Texture2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); tex2D.SetData<Color>(colors); String filename … Continue reading

Posted in XNA | Tagged | Leave a comment