public override void Process(ITimeService time) { IsEnabled = false; var device = Services.GetService <IGraphicsDeviceService>().DirectXDevice; var cScreenshot = Entities.First().GetComponent <ScreenshotComponent>(); var backBuffer = device.BackBuffer; var textureDescription = new Texture2DDescription() { CpuAccessFlags = CpuAccessFlags.None, Format = backBuffer.Format.Value, Height = backBuffer.Height, Usage = ResourceUsage.Default, Width = backBuffer.Width, ArraySize = 1, SampleDescription = new SampleDescription(1, 0), BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource, MipLevels = 1, OptionFlags = ResourceOptionFlags.None }; renderTarget = RenderTarget2D.New(device, textureDescription); var depthStencilDesc = new Texture2DDescription() { ArraySize = 1, MipLevels = 1, BindFlags = BindFlags.DepthStencil, Format = device.DepthStencilBuffer.Format.Value, Width = textureDescription.Width, Height = textureDescription.Height, SampleDescription = textureDescription.SampleDescription, CpuAccessFlags = CpuAccessFlags.None, Usage = ResourceUsage.Default, OptionFlags = ResourceOptionFlags.None }; depthStencil = DepthStencilBuffer.New(device, depthStencilDesc); ((DeviceContext)device).ResolveSubresource(backBuffer, 0, renderTarget, 0, textureDescription.Format); renderTarget.Initialize(); depthStencil.Initialize(); device.SetRenderTargets(depthStencil, renderTarget); renderTarget.Save("test.png", ImageFileType.Png); renderTarget.Dispose(); depthStencil.Dispose(); IsEnabled = false; }