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


C# GraphicsContext.GetFrameBuffer方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: PackedIndexedSprite

    public PackedIndexedSprite(GraphicsContext graphics, Int32 maxNumOfSprite=1000)
    {
        m_graphics = graphics;
        m_ShaderProgram = CreatePackedSpriteShader();
        m_maxNumOfSprite = maxNumOfSprite;

        int width = m_graphics.GetFrameBuffer().Width;
        int height = m_graphics.GetFrameBuffer().Height;

        // 頂点バッファを2つ作成。
        for(int i = 0; i < m_vertexBuffer.Length; ++i){
            m_vertexBuffer[i] = new VertexBuffer(
                4*m_maxNumOfSprite,
                6*m_maxNumOfSprite,
                VertexFormat.Short4,
                VertexFormat.UByte4N
                );
        }

        // index
        {
            int numIndices = 6 * m_maxNumOfSprite;
            ushort[] indices = new ushort[numIndices];
            for(int i = 0, wp = 0; i < m_maxNumOfSprite; ++i)
            {
                int vnum = i*4;

                indices[wp++] = (ushort)(0+vnum);
                indices[wp++] = (ushort)(1+vnum);
                indices[wp++] = (ushort)(2+vnum);

                indices[wp++] = (ushort)(1+vnum);
                indices[wp++] = (ushort)(3+vnum);
                indices[wp++] = (ushort)(2+vnum);
            }
            m_vertexBuffer[0].SetIndices(indices);
            m_vertexBuffer[1].SetIndices(indices);
            m_vertexBuffer[2].SetIndices(indices);

        }

        m_spritePrimBuffer = new SpritePrim[m_maxNumOfSprite];
    }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:43,代码来源:PackedIndexedSprite.cs

示例5: Initialize

		public static void Initialize ()
		{
			// Set up the graphics system
			_graphics = new GraphicsContext ();
			
			_viewportWidth = _graphics.GetFrameBuffer().Width;
			_viewportHeight= _graphics.GetFrameBuffer().Height;
			
			_texture = new Texture2D("/images.jpg", false);
			
			_vertexBuffer = new VertexBuffer(4, VertexFormat.Float3, VertexFormat.Float2);
			_vertexBuffer.SetVertices(0, new float[]{
				1,0,0, 
				_texture.Width,0,0, 
				_texture.Width, 
				_texture.Height,0,0,
				_texture.Height,0});
			
			_vertexBuffer.SetVertices(1, new float[]{
				0.0f, 0.0f,
				1.0f, 0.0f,
				1.0f, 1.0f,
				0.0f, 1.0f});
			
			_textureShaderProgram = new ShaderProgram("/Application/shaders/Texture.cgx");
			
			_projectionMatrix = Matrix4.Ortho (0,_viewportWidth,0,_viewportHeight,0.0f,32768.0f);
			
			_viewMatrix = Matrix4.LookAt(
				new Vector3(0,_viewportHeight,0), 
				new Vector3(0,_viewportHeight,1),
				new Vector3(0,-1,0));
			
			_localMatrix = Matrix4.Translation(new Vector3(-_texture.Width/2,-_texture.Height/2,0.0f))
				* Matrix4.Translation(new Vector3(_viewportWidth/2, _viewportHeight/2,0.0f));
		}
开发者ID:jplebre,项目名称:Books.DevelopingForPSM,代码行数:36,代码来源:AppMain.cs

示例6: Init

 /// 初期化
 public static bool Init(GraphicsContext graphicsContext)
 {
     return Init(graphicsContext,
             graphicsContext.GetFrameBuffer().Width,
             graphicsContext.GetFrameBuffer().Height);
 }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:7,代码来源:Graphics2D.cs

示例7: InitializeGraphicsContext

        private void InitializeGraphicsContext(GraphicsContext graphicsContext)
        {
            GraphicsContext = graphicsContext;

            ScreenWidth = GraphicsContext.Screen.Rectangle.Width;
            ScreenHeight = GraphicsContext.Screen.Rectangle.Height;

            FrameBufferWidth = GraphicsContext.GetFrameBuffer().Width;
            FrameBufferWidthAsSingle = (Single)FrameBufferWidth;
            FrameBufferHeight = GraphicsContext.GetFrameBuffer().Height;
            FrameBufferHeightAsSingle = (Single)FrameBufferHeight;
        }
开发者ID:artron33,项目名称:PsmFramework,代码行数:12,代码来源:DrawEngine2d.cs

示例8: Init

        /// public メソッド
        ///---------------------------------------------------------------------------
        /// 初期化
        public bool Init()
        {
            useGraphics		= new GraphicsContext();
            displayWidth	= useGraphics.GetFrameBuffer().Width;
            displayHeight	= useGraphics.GetFrameBuffer().Height;

            ClearCurrentCamera();
            return true;
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:12,代码来源:GraphicsDevice.cs

示例9: InitializeGraphicsContext

        private void InitializeGraphicsContext(GraphicsContext graphicsContext, CoordinateSystemMode coordinateSystemMode)
        {
            GraphicsContext = graphicsContext;
            CoordinateSystemMode = coordinateSystemMode;

            ScreenWidth = GraphicsContext.Screen.Rectangle.Width;
            ScreenHeight = GraphicsContext.Screen.Rectangle.Height;

            FrameBuffer fb = GraphicsContext.GetFrameBuffer();

            FrameBufferWidth = fb.Width;
            FrameBufferHeight = fb.Height;

            FrameBufferWidthAsSingle = (Single)FrameBufferWidth;
            FrameBufferHeightAsSingle = (Single)FrameBufferHeight;
        }
开发者ID:artwallace,项目名称:PsmFramework,代码行数:16,代码来源:DrawEngine2d.cs


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