我有一个使用Reach图形设置在C#XNA 4.0中编码的Windows平台游戏.我的项目基于GameStateManagement示例,但后来我添加了Bloom和spriteSheet/spriteBatch功能.
我希望保存最终屏幕输出的屏幕截图.但是,当我保存我的截图时,它只显示Bloom应用之前和我的HUD文本显示之前的渲染(我在Bloom之后绘制).在这两个过程之后,我的Draw方法结束时保存了截图.
我尝试过各种各样的事情.安德鲁的答案在这里拍摄XNA中的屏幕截图是有帮助的并且可以保存图像; 但是,它并没有保存最终渲染.
我有一种感觉它与绽放过程或spograbatch有关.
这是我的代码:
example {
public override void Draw(GameTime gameTime)
{
ScreenManager.GraphicsDevice.SetRenderTarget(sceneRenderTarget);
// Clear the screen to black
ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
Color.Black, 0, 0);
SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
// then i draw all my game stuff
spriteBatch.End();
#region Post-Processing & Bloom
ScreenManager.GraphicsDevice.SamplerStates[1] = SamplerState.LinearClamp;
// Pass 1: draw the scene into rendertarget 1, using a
// shader that extracts only the brightest parts of the image.
bloomExtractEffect.Parameters["BloomThreshold"].SetValue(
Settings.BloomThreshold);
DrawFullscreenQuad(sceneRenderTarget, renderTarget1,
bloomExtractEffect,
IntermediateBuffer.PreBloom); …Run Code Online (Sandbox Code Playgroud)