Graphics Reference
In-Depth Information
// Set pixel shader
if (ShaderResources != null && ShaderResources.Length >
0 && !ShaderResources[0].IsDisposed)
{
context.PixelShader.SetShaderResources(0,
ShaderResources);
}
// Set a default pixel shader
if (Shader != null)
{
context.PixelShader.Set(Shader);
}
// Set vertex shader
context.VertexShader.Set(vertexShader);
// Update vertex layout to use
context.InputAssembler.InputLayout = vertexLayout;
// Tell the IA we are using a triangle strip
context.InputAssembler.PrimitiveTopology =
SharpDX.Direct3D.PrimitiveTopology.TriangleStrip;
// Pass in the vertices (note: only 4 vertices)
context.InputAssembler.SetVertexBuffers(0,
vertexBinding);
// Draw the 4 vertices that make up the triangle strip
context.Draw(4, 0);
// Unbind pixel shader resources
if (ShaderResources != null && ShaderResources.Length >
0)
{
context.PixelShader.SetShaderResources(0, new
ShaderResourceView[ShaderResources.Length]);
}
// Restore previous shader and IA settings
context.PixelShader.Set(oldPixelShader);
context.VertexShader.Set(oldVertexShader);
context.InputAssembler.InputLayout = oldVertexLayout;
}
This completes our ScreenAlignedQuadRenderer class.
 
Search WWH ::




Custom Search