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


C# GraphicsContext.SetFrameBuffer方法代码示例

本文整理汇总了C#中GraphicsContext.SetFrameBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsContext.SetFrameBuffer方法的具体用法?C# GraphicsContext.SetFrameBuffer怎么用?C# GraphicsContext.SetFrameBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphicsContext的用法示例。


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

示例1: Filter

        public void Filter( GraphicsContext graphics )
        {
            // Y軸方向へのガウス
            // uniform
            shaderGaussianX.SetUniformValue( shaderGaussianX.FindUniform( "ReciprocalTexWidth" ),
                                         1.0f / texScene.Width );
            shaderGaussianX.SetUniformValue( shaderGaussianX.FindUniform( "Weight" ), 0, gaussianWeightTable );
            Vector2 offset = new Vector2( 16.0f / texScene.Width, 0.0f );
            shaderGaussianX.SetUniformValue( shaderGaussianX.FindUniform( "Offset" ), ref offset );

            // render
            FrameBuffer oldBuffer = graphics.GetFrameBuffer();

            if( this.Target != null ){
            graphics.SetFrameBuffer( this.Target );
            }

            texRenderer.BindGraphicsContext( graphics );
            texRenderer.Begin( shaderGaussianX );
            texRenderer.Render( texScene );
            texRenderer.End();

            if( this.Target != null ){
            graphics.SetFrameBuffer( oldBuffer );
            }
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:26,代码来源:GaussianXFilter.cs

示例2: Filter

        /// フィルタ処理の実行
        public void Filter( GraphicsContext graphics )
        {
            texRenderer.BindGraphicsContext( graphics );
            FrameBuffer oldBuffer = graphics.GetFrameBuffer();

            bool isSwap = false;
            int width = oldBuffer.Width;
            int height = oldBuffer.Height;

            if( this.Target != null ){
            graphics.SetFrameBuffer( this.Target );
            width = this.Target.Width;
            height = this.Target.Height;
            isSwap = true;
            }
            graphics.SetViewport( 0, 0, width, height );

            texRenderer.Begin( shaderDOF );
            graphics.SetTexture( 2, texDepth );
            texRenderer.Render( texScene,
                            texBlur,
                            0, 0, 0, 0, width, height );
            texRenderer.End();
            if( isSwap ){
            graphics.SetFrameBuffer( oldBuffer );
            }
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:28,代码来源:DepthOfFealdFilter.cs

示例3: Filter

        public void Filter( GraphicsContext graphics )
        {
            // Y軸方向へのガウス
            // uniform
            int idReciprocalTexHeight = shaderGaussianY.FindUniform( "ReciprocalTexHeight" );
            if( idReciprocalTexHeight >= 0 ){
            shaderGaussianY.SetUniformValue( idReciprocalTexHeight, 1.0f / texScene.Height );
            }
            int idWeight = shaderGaussianY.FindUniform( "Weight" );
            if( idWeight >= 0 ){
            shaderGaussianY.SetUniformValue( idWeight, 0, gaussianWeightTable );
            }
            int idOffset = shaderGaussianY.FindUniform( "Offset" );
            if( idOffset >= 0 ){
            Vector2 offset = new Vector2( 0.0f, 16.0f / texScene.Height );
            shaderGaussianY.SetUniformValue( idOffset, ref offset );
            }

            // render
            FrameBuffer oldBuffer = graphics.GetFrameBuffer();

            if( this.Target != null ){
            graphics.SetFrameBuffer( this.Target );
            }

            texRenderer.BindGraphicsContext( graphics );
            texRenderer.Begin( shaderGaussianY );
            texRenderer.Render( texScene );
            texRenderer.End();

            if( this.Target != null ){
            graphics.SetFrameBuffer( oldBuffer );
            }
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:34,代码来源:GaussianYFilter.cs


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