本文整理汇总了C#中GraphicsDevice.ResolveBackBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsDevice.ResolveBackBuffer方法的具体用法?C# GraphicsDevice.ResolveBackBuffer怎么用?C# GraphicsDevice.ResolveBackBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsDevice
的用法示例。
在下文中一共展示了GraphicsDevice.ResolveBackBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostProcess
public void PostProcess(GraphicsDevice a_graphicsDevice)
{
if (ResolvedTexture.Width != a_graphicsDevice.Viewport.Width ||
ResolvedTexture.Height != a_graphicsDevice.Viewport.Height ||
ResolvedTexture.Format != a_graphicsDevice.DisplayMode.Format)
{
LoadResolveTarget(a_graphicsDevice);
}
a_graphicsDevice.ResolveBackBuffer(ResolvedTexture);
a_graphicsDevice.Textures[0] = ResolvedTexture;
BackingEffect.Begin();
foreach (EffectPass pass in BackingEffect.CurrentTechnique.Passes)
{
pass.Begin();
a_graphicsDevice.VertexDeclaration = VertexDeclaration;
a_graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, Vertices, 0, 2);
pass.End();
}
BackingEffect.End();
EffectManager.ScreenTexture = ResolvedTexture;
}
示例2: UpDownIcon_ValueChanged
private void UpDownIcon_ValueChanged(object sender, EventArgs e)
{
try
{
if (this.IconBmp != null)
{
this.IconBmp.Dispose();
}
PresentationParameters presentationParameters = new PresentationParameters();
presentationParameters.AutoDepthStencilFormat = DepthFormat.Depth24;
presentationParameters.BackBufferCount = 1;
presentationParameters.BackBufferFormat = SurfaceFormat.Color;
presentationParameters.BackBufferHeight = 39;
presentationParameters.BackBufferWidth = 39;
presentationParameters.EnableAutoDepthStencil = true;
presentationParameters.FullScreenRefreshRateInHz = 0;
presentationParameters.IsFullScreen = false;
presentationParameters.MultiSampleQuality = 0;
presentationParameters.MultiSampleType = MultiSampleType.NonMaskable;
presentationParameters.PresentationInterval = PresentInterval.One;
presentationParameters.PresentOptions = PresentOptions.None;
presentationParameters.RenderTargetUsage = RenderTargetUsage.DiscardContents;
presentationParameters.SwapEffect = SwapEffect.Discard;
GraphicsDevice graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.Hardware, new Panel().Handle, presentationParameters);
this.copiedIcon = new Sprite(graphicsDevice);
int index = Convert.ToInt32(this.numericUpDownIcon.Value) / 169;
int index2 = Convert.ToInt32(this.numericUpDownIcon.Value) % 169;
this.copiedIcon.LoadTextureFromFile(this.ImportedContentFolder + "\\3DDATA\\Control\\RES\\" + this.ImportedTSI.listDDS[index].Path, new Vector2(0f, 0f), new Microsoft.Xna.Framework.Rectangle(this.ImportedTSI.listDDS[index].ListDDS_element[index2].X, this.ImportedTSI.listDDS[index].ListDDS_element[index2].Y, this.ImportedTSI.listDDS[index].ListDDS_element[index2].Width, this.ImportedTSI.listDDS[index].ListDDS_element[index2].Height));
graphicsDevice.Clear(Microsoft.Xna.Framework.Graphics.Color.White);
SpriteBatch spriteBatch = new SpriteBatch(graphicsDevice);
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
spriteBatch.Draw(this.copiedIcon.texture, new Vector2(0f, 0f), new Microsoft.Xna.Framework.Rectangle?(this.copiedIcon.sourceRectangle), Microsoft.Xna.Framework.Graphics.Color.White);
spriteBatch.End();
using (ResolveTexture2D resolveTexture2D = new ResolveTexture2D(graphicsDevice, graphicsDevice.PresentationParameters.BackBufferWidth, graphicsDevice.PresentationParameters.BackBufferHeight, 1, SurfaceFormat.Color))
{
graphicsDevice.ResolveBackBuffer(resolveTexture2D);
resolveTexture2D.Save("Imported Icon.bmp", ImageFileFormat.Bmp);
}
this.pictureBox.ImageLocation = "Imported Icon.bmp";
this.IconBmp = new Bitmap("Imported Icon.bmp");
this.copiedIcon = new Sprite(this.textureControl.GraphicsDevice);
this.copiedIcon.LoadTextureFromFile(this.ImportedContentFolder + "\\3DDATA\\Control\\RES\\" + this.ImportedTSI.listDDS[index].Path, new Vector2(0f, 0f), new Microsoft.Xna.Framework.Rectangle(this.ImportedTSI.listDDS[index].ListDDS_element[index2].X, this.ImportedTSI.listDDS[index].ListDDS_element[index2].Y, this.ImportedTSI.listDDS[index].ListDDS_element[index2].Width + 1, this.ImportedTSI.listDDS[index].ListDDS_element[index2].Height + 1));
}
catch
{
}
}