protected override void Draw ( GameTime gameTime, StereoEye stereoEye )
{
// Clear back buffer :
GraphicsDevice.ClearBackbuffer( new Color4(0,0,0,1) );
// Update constant buffer and bound it to pipeline:
cbData.Transform = Matrix.OrthoRH( 4, 3, -2, 2 );
cbData.Time = 0.001f * (float)gameTime.Total.TotalMilliseconds;
cb.SetData( cbData );
GraphicsDevice.VertexShaderConstants[0] = cb ;
GraphicsDevice.PixelShaderConstants[0] = cb ;
// Fill vertex buffer :
var v0 = new Vertex{ Position = new Vector3( -1.0f, -1.0f, 0 ), Color = Color.Red, TexCoord = new Vector2(0,1) };
var v1 = new Vertex{ Position = new Vector3( 1.0f, 1.0f, 0 ), Color = Color.White, TexCoord = new Vector2(1,0) };
var v2 = new Vertex{ Position = new Vector3( -1.0f, 1.0f, 0 ), Color = Color.Blue, TexCoord = new Vector2(0,0) };
var v3 = new Vertex{ Position = new Vector3( -1.0f, -1.0f, 0 ), Color = Color.Red, TexCoord = new Vector2(0,1) };
var v4 = new Vertex{ Position = new Vector3( 1.0f, -1.0f, 0 ), Color = Color.Lime, TexCoord = new Vector2(1,1) };
var v5 = new Vertex{ Position = new Vector3( 1.0f, 1.0f, 0 ), Color = Color.White, TexCoord = new Vector2(1,0) };//*/
var data = new Vertex[]{ v0, v1, v2, v3, v4, v5 };
vb.SetData( data, 0, 6 );
// Set required ubershader :
// Set device states :
GraphicsDevice.PipelineState = factory[0];
GraphicsDevice.PixelShaderSamplers[0] = SamplerState.LinearWrap ;
// Setup texture :
GraphicsDevice.PixelShaderResources[0] = tex ;
GraphicsDevice.VertexShaderResources[1] = instDataGpu ;
// Setup vertex data and draw :
GraphicsDevice.SetupVertexInput( vb, null );
GraphicsDevice.DrawInstanced( 6, InstanceCount, 0, 0 );
base.Draw( gameTime, stereoEye );
}
}