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


C# RenderTargetUsage类代码示例

本文整理汇总了C#中RenderTargetUsage的典型用法代码示例。如果您正苦于以下问题:C# RenderTargetUsage类的具体用法?C# RenderTargetUsage怎么用?C# RenderTargetUsage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RenderTargetUsage类属于命名空间,在下文中一共展示了RenderTargetUsage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderTarget2D

 public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, 
     SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
     : base(graphicsDevice, width, height, mipMap, preferredFormat)
 {
     RenderTargetUsage = usage;
     //allocateOpenGLTexture();
 }
开发者ID:andreesteve,项目名称:MonoGame,代码行数:7,代码来源:RenderTarget2D.cs

示例2: BackBuffer

        public BackBuffer(GraphicsDevice graphicsDevice, string name)
        {
            if (graphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice");
            }

            this.graphicsDevice = graphicsDevice;

            Name = name;

            var pp = graphicsDevice.PresentationParameters;
            width = pp.BackBufferWidth;
            height = pp.BackBufferHeight;
            mipMap = true;
            surfaceFormat = pp.BackBufferFormat;
            depthFormat = pp.DepthStencilFormat;
            multiSampleCount = pp.MultiSampleCount;
            renderTargetUsage = pp.RenderTargetUsage;

            renderTargetCount = 1;
            currentIndex = 0;

            activated = false;
            disposed = false;
        }
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:26,代码来源:BackBuffer.cs

示例3: RenderTarget2D

 public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
   : base(graphicsDevice, width, height, mipMap, preferredFormat, true)
 {
   RenderTarget2D renderTarget2D = this;
   this.DepthStencilFormat = preferredDepthFormat;
   this.MultiSampleCount = preferredMultiSampleCount;
   this.RenderTargetUsage = usage;
   if (preferredDepthFormat == DepthFormat.None)
     return;
   Threading.BlockOnUIThread((Action) (() =>
   {
     GL.GenRenderbuffers(1, out renderTarget2D.glDepthStencilBuffer);
     GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, renderTarget2D.glDepthStencilBuffer);
     RenderbufferStorage local_0 = RenderbufferStorage.DepthComponent16;
     switch (preferredDepthFormat)
     {
       case DepthFormat.Depth24Stencil8:
         local_0 = RenderbufferStorage.Depth24Stencil8;
         break;
       case DepthFormat.Depth24:
         local_0 = RenderbufferStorage.DepthComponent24;
         break;
       case DepthFormat.Depth16:
         local_0 = RenderbufferStorage.DepthComponent16;
         break;
     }
     if (renderTarget2D.MultiSampleCount == 0)
       GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, local_0, renderTarget2D.width, renderTarget2D.height);
     else
       GL.RenderbufferStorageMultisample(RenderbufferTarget.Renderbuffer, renderTarget2D.MultiSampleCount, local_0, renderTarget2D.width, renderTarget2D.height);
   }));
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:32,代码来源:RenderTarget2D.cs

示例4: RenderTarget2D

		public RenderTarget2D (GraphicsDevice graphicsDevice, int width, int height, bool mipMap, 
			SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
			:base (graphicsDevice, width, height, mipMap, preferredFormat)
		{


#if IPHONE
			if(GraphicsDevice.OpenGLESVersion == MonoTouch.OpenGLES.EAGLRenderingAPI.OpenGLES2)

			{
				GL20.GenFramebuffers(1, ref frameBuffer);
			}
			else
			{
				RenderTargetUsage = usage;
				DepthStencilFormat = preferredDepthFormat;
			}
#elif ANDROID
            if (GraphicsDevice.OpenGLESVersion == OpenTK.Graphics.GLContextVersion.Gles2_0)
            {
                GL20.GenFramebuffers(1, ref frameBuffer);
            }
            else
            {
                RenderTargetUsage = usage;
                DepthStencilFormat = preferredDepthFormat;
            }
#else
				RenderTargetUsage = usage;
				DepthStencilFormat = preferredDepthFormat;
#endif


        }
开发者ID:adison,项目名称:Tank-Wars,代码行数:34,代码来源:RenderTarget2D.cs

示例5: OpenGLRenderTarget2D

        /// <summary>
        /// Initializes a new instance of the OpenGLRenderTarget2D class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="width">The render target's width in pixels.</param>
        /// <param name="height">The render target's height in pixels.</param>
        /// <param name="usage">A <see cref="RenderTargetUsage"/> value specifying whether the 
        /// render target's data is discarded or preserved when it is bound to the graphics device.</param>
        /// <param name="buffers">The collection of render buffers to attach to the target.</param>
        public OpenGLRenderTarget2D(UltravioletContext uv, Int32 width, Int32 height, RenderTargetUsage usage, IEnumerable<RenderBuffer2D> buffers = null)
            : base(uv)
        {
            Contract.EnsureRange(width > 0, nameof(width));
            Contract.EnsureRange(height > 0, nameof(height));

            // NOTE: If we're in an older version of GLES, we need to use glFramebufferTexture2D()
            glFramebufferTextureIsSupported = !gl.IsGLES || gl.IsVersionAtLeast(3, 2);

            glDrawBuffersIsSupported = !gl.IsGLES2 || gl.IsExtensionSupported("GL_ARB_draw_buffers");
            glDrawBufferIsSupported = !gl.IsGLES;

            var framebuffer = 0u;

            uv.QueueWorkItemAndWait(() =>
            {
                using (OpenGLState.ScopedCreateFramebuffer(out framebuffer))
                {
                    if (buffers != null)
                    {
                        foreach (OpenGLRenderBuffer2D buffer in buffers)
                        {
                            AttachRenderBuffer(buffer);
                        }
                    }
                }
            });

            this.width = width;
            this.height = height;
            this.framebuffer = framebuffer;
            this.renderTargetUsage = usage;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:42,代码来源:OpenGLRenderTarget2D.cs

示例6: PlatformConstruct

        private void PlatformConstruct(GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
            SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
        {
            // Setup the multisampling description.
            var multisampleDesc = new SharpDX.DXGI.SampleDescription(1, 0);
            if (preferredMultiSampleCount > 1)
            {
                multisampleDesc.Count = preferredMultiSampleCount;
                multisampleDesc.Quality = (int)StandardMultisampleQualityLevels.StandardMultisamplePattern;
            }

            // Create a descriptor for the depth/stencil buffer.
            // Allocate a 2-D surface as the depth/stencil buffer.
            // Create a DepthStencil view on this surface to use on bind.
            using (var depthBuffer = new SharpDX.Direct3D11.Texture2D(graphicsDevice._d3dDevice, new Texture2DDescription
            {
                Format = SharpDXHelper.ToFormat(preferredDepthFormat),
                ArraySize = 1,
                MipLevels = 1,
                Width = width,
                Height = height,
                SampleDescription = multisampleDesc,
                BindFlags = BindFlags.DepthStencil,
            }))
            {
                // Create the view for binding to the device.
                _depthStencilView = new DepthStencilView(graphicsDevice._d3dDevice, depthBuffer, new DepthStencilViewDescription()
                {
                    Format = SharpDXHelper.ToFormat(preferredDepthFormat),
                    Dimension = DepthStencilViewDimension.Texture2D
                });
            }
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:33,代码来源:RenderTarget3D.DirectX.cs

示例7: SetupGraphicsDeviceManager

 protected override void SetupGraphicsDeviceManager(GraphicsDeviceManager graphics, ref RenderTargetUsage presentation)
 {
     graphics.IsFullScreen = Globals.useFullScreen;
     graphics.PreferredBackBufferWidth = Globals.screenWidth;
     graphics.PreferredBackBufferHeight = Globals.screenHeight;
     base.SetupGraphicsDeviceManager(graphics, ref presentation);
 }
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:7,代码来源:Game1.cs

示例8: New

        public static ITexture2D New(VideoTypes videoType, IDisposableResource parent, Image image, int width, int height, bool generateMipmaps, MultiSampleTypes multiSampleType, SurfaceFormats surfaceFormat, RenderTargetUsage renderTargetUsage, BufferUsages usage, Loader.LoadedCallbackMethod loadedCallback)
        {
            ITexture2D api = null;

            #if WIN32
            if (videoType == VideoTypes.D3D9) api = new D3D9.Texture2D(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, loadedCallback);
            #endif

            #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11) api = new D3D11.Texture2D(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, loadedCallback);
            #endif

            #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL) api = new OpenGL.Texture2D(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, loadedCallback);
            #endif

            #if XNA
            if (videoType == VideoTypes.XNA) api = new XNA.Texture2D(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, loadedCallback);
            #endif

            #if VITA
            if (videoType == VideoTypes.Vita) api = new Vita.Texture2D(parent, image, width, height, generateMipmaps, multiSampleType, surfaceFormat, renderTargetUsage, usage, loadedCallback);
            #endif

            if (api == null) Debug.ThrowError("Texture2DAPI", "Unsuported InputType: " + videoType);
            return api;
        }
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:27,代码来源:Texture2D.cs

示例9: GetIntermediateTexture

        public IntermediateRenderTarget GetIntermediateTexture(int width, int height, bool mipmap, SurfaceFormat SurfaceFormat, DepthFormat DepthFormat, int preferedMultisampleCount, RenderTargetUsage RenderTargetUsage)
        {
            // Look for a matching rendertarget in the cache
            for (int i = 0; i < intermediateTextures.Count; i++)
            {
                if (intermediateTextures[i].InUse == false
                    && height == intermediateTextures[i].RenderTarget.Height
                    && width == intermediateTextures[i].RenderTarget.Width
                    && preferedMultisampleCount == intermediateTextures[i].RenderTarget.MultiSampleCount
                    && SurfaceFormat == intermediateTextures[i].RenderTarget.Format
                    && DepthFormat == intermediateTextures[i].RenderTarget.DepthStencilFormat
                    && RenderTargetUsage == intermediateTextures[i].RenderTarget.RenderTargetUsage
                    && (mipmap == true && intermediateTextures[i].RenderTarget.LevelCount > 0 || mipmap == false && intermediateTextures[i].RenderTarget.LevelCount == 0)

                    )
                {
                    intermediateTextures[i].InUse = true;
                    return intermediateTextures[i];
                }
            }

            // We didn't find one, let's make one
            IntermediateRenderTarget newTexture = new IntermediateRenderTarget();
            newTexture.RenderTarget = new RenderTarget2D(device,width, height, mipmap, SurfaceFormat,DepthFormat, preferedMultisampleCount, RenderTargetUsage );
            intermediateTextures.Add(newTexture);
            newTexture.InUse = true;
            return newTexture;
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:28,代码来源:IntermediateTexture.cs

示例10: PostProcesses

 public PostProcesses(SurfaceFormat? surface = null, DepthFormat? depth = null, bool mipmap = false, RenderTargetUsage? usage = null)
 {
     FormatSurface = surface;
     FormatDepth   = depth;
     MipMap        = mipmap;
     Usage         = usage;
 }
开发者ID:zdawson,项目名称:Marooned,代码行数:7,代码来源:PostProcesses.cs

示例11: RenderTarget2D

        public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, 
			SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
            : base(graphicsDevice, width, height, mipMap, preferredFormat)
        {
            RenderTargetUsage = usage;
            DepthStencilFormat = preferredDepthFormat;
        }
开发者ID:Grapes,项目名称:MonoGame,代码行数:7,代码来源:RenderTarget2D.cs

示例12: SetupGraphicsDeviceManager

		protected override void SetupGraphicsDeviceManager(GraphicsDeviceManager graphics, ref RenderTargetUsage presentation)
		{
			if (graphics != null)
			{
				graphics.PreferredBackBufferWidth = 1280;
				graphics.PreferredBackBufferHeight = 720;
			}
		}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:8,代码来源:Xen+Logo.cs

示例13: RenderTargetCube

 public RenderTargetCube(GraphicsDevice graphicsDevice, int size, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
   : base(graphicsDevice, size, mipMap, preferredFormat, true)
 {
   this.DepthStencilFormat = preferredDepthFormat;
   this.MultiSampleCount = preferredMultiSampleCount;
   this.RenderTargetUsage = usage;
   throw new NotImplementedException();
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:8,代码来源:RenderTargetCube.cs

示例14: RenderTarget2D

	    public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, bool shared, int arraySize)
	        : base(graphicsDevice, width, height, mipMap, preferredFormat, SurfaceType.RenderTarget, shared, arraySize)
	    {
            DepthStencilFormat = preferredDepthFormat;
            MultiSampleCount = preferredMultiSampleCount;
            RenderTargetUsage = usage;

            PlatformConstruct(graphicsDevice, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage, shared);
	    }
开发者ID:Cardanis,项目名称:MonoGame,代码行数:9,代码来源:RenderTarget2D.cs

示例15: RenderTarget2D

		public RenderTarget2D (GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
         					   SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount,
		                       RenderTargetUsage usage)
			:base(graphicsDevice, width, height,0, TextureUsage.None, format)
		{				
			
			allocateOpenGLTexture();
			
		}
开发者ID:johnkwaters,项目名称:MonoGame,代码行数:9,代码来源:RenderTarget2D.cs


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