• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RenderTargetUsage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: RenderTargetProperties

 /// <summary>
 /// Initializes a new instance of the <see cref="RenderTargetProperties"/> struct.
 /// </summary>
 /// <param name="type">A value that specifies whether the render target should force hardware or software rendering. A value of <see cref="SharpDX.Direct2D1.RenderTargetType.Default"/> specifies that the render target should use hardware rendering if it is available; otherwise, it uses software rendering. Note that WIC bitmap render targets do not support hardware rendering.</param>
 /// <param name="pixelFormat">The pixel format and alpha mode of the render target. You can use the {{D2D1::PixelFormat}} function to create a pixel format that specifies that Direct2D should select the pixel format and alpha mode for you. For a list of pixel formats and alpha modes supported by each render target, see {{Supported Pixel Formats and Alpha Modes}}.</param>
 /// <param name="dpiX">The horizontal DPI of the render target.  To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section. 	</param>
 /// <param name="dpiY">The vertical DPI of the render target. To use the default DPI, set dpiX and dpiY to 0.  For more information, see the Remarks section. 	</param>
 /// <param name="usage">A value that specifies how the render target is remoted and whether it should be GDI-compatible.  Set to <see cref="SharpDX.Direct2D1.RenderTargetUsage.None"/> to create a render target that is not compatible with GDI and uses Direct3D command-stream remoting if it  is available.</param>
 /// <param name="minLevel">A value that specifies the minimum Direct3D feature level required for hardware rendering. If the specified minimum level is not available, the render target uses software rendering if the type  member is set to <see cref="SharpDX.Direct2D1.RenderTargetType.Default"/>; if  type  is set to to D2D1_RENDER_TARGET_TYPE_HARDWARE, render target creation fails. A value of <see cref="SharpDX.Direct2D1.FeatureLevel.Level_DEFAULT"/> indicates that Direct2D should determine whether the Direct3D feature level of the device is adequate. This field is used only when creating <see cref="WindowRenderTarget"/> and <see cref="DeviceContextRenderTarget"/> objects.	</param>  
 public RenderTargetProperties(RenderTargetType type, PixelFormat pixelFormat, float dpiX, float dpiY, RenderTargetUsage usage, FeatureLevel minLevel)
 {
     Type = type;
     PixelFormat = pixelFormat;
     DpiX = dpiX;
     DpiY = dpiY;
     Usage = usage;
     MinLevel = minLevel;
 }
开发者ID:Nezz,项目名称:SharpDX,代码行数:18,代码来源:RenderTargetProperties.cs


示例17: PlatformConstruct

 private void PlatformConstruct(GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
     SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, bool shared)
 {
     Threading.BlockOnUIThread(() =>
     {
         graphicsDevice.PlatformCreateRenderTarget(this, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage);
     });
     
     
 }
开发者ID:Zodge,项目名称:MonoGame,代码行数:10,代码来源:RenderTarget2D.OpenGL.cs


示例18: RenderTargetInfo

 public RenderTargetInfo(int width, int height, SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount, bool mipMap, RenderTargetUsage usage)
 {
     Width = width;
     Height = height;
     SurfaceFormat = format;
     DepthFormat = depthFormat;
     MultiSampleCount = multiSampleCount;
     MipMap = mipMap;
     Usage = usage;
 }
开发者ID:xoxota99,项目名称:Myre,代码行数:10,代码来源:RenderTargetManager.cs


示例19: InitWithWidthAndHeight

 protected virtual bool InitWithWidthAndHeight(int w, int h, SurfaceFormat colorFormat, DepthFormat depthFormat, RenderTargetUsage usage)
 {
     m_Width = (int)Math.Ceiling(w * CCMacros.CCContentScaleFactor());
     m_Height = (int)Math.Ceiling(h * CCMacros.CCContentScaleFactor());
     m_ColorFormat = colorFormat;
     m_DepthFormat = depthFormat;
     m_Usage = usage;
     MakeTexture();
     return true;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:10,代码来源:CCRenderTexture.cs


示例20: RenderTargetOperation

            public RenderTargetOperation(RenderTarget2D renderTarget, GraphicsDevice graphicsDevice, Color backgroundColor)
            {
                _graphicsDevice = graphicsDevice;
                _viewport = _graphicsDevice.Viewport;
                _previousRenderTargetUsage = _graphicsDevice.PresentationParameters.RenderTargetUsage;

                _graphicsDevice.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
                _graphicsDevice.SetRenderTarget(renderTarget);
                _graphicsDevice.Clear(backgroundColor);
            }
开发者ID:Mikescher,项目名称:MonoGame.Extended,代码行数:10,代码来源:RenderTarget2DExtensions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RenderTargetView类代码示例发布时间:2022-05-24
下一篇:
C# RenderTarget类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap