本文整理汇总了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 );
}
}
示例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 );
}
}
示例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 );
}
}