本文整理汇总了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 );
}
}
示例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 );
}
}
示例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 );
}
}
示例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];
}
示例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));
}
示例6: Init
/// 初期化
public static bool Init(GraphicsContext graphicsContext)
{
return Init(graphicsContext,
graphicsContext.GetFrameBuffer().Width,
graphicsContext.GetFrameBuffer().Height);
}
示例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;
}
示例8: Init
/// public メソッド
///---------------------------------------------------------------------------
/// 初期化
public bool Init()
{
useGraphics = new GraphicsContext();
displayWidth = useGraphics.GetFrameBuffer().Width;
displayHeight = useGraphics.GetFrameBuffer().Height;
ClearCurrentCamera();
return true;
}
示例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;
}