当前位置: 首页>>代码示例>>C#>>正文


C# GraphicsDevice.ResolveBackBuffer方法代码示例

本文整理汇总了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;
        }
开发者ID:kirlianstudios,项目名称:armada,代码行数:23,代码来源:PostProcessor.cs

示例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
     {
     }
 }
开发者ID:Jiwan,项目名称:ROSE-Content-Importer,代码行数:47,代码来源:IconForm.cs


注:本文中的GraphicsDevice.ResolveBackBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。