context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip; context.InputAssembler.SetVertexBuffers(0, new[] { new VertexBufferBinding(_device, sprite, 0) });
class Program { private static Device _device; private static SwapChain _swapChain; private static Texture2D _texture; private static ShaderResourceView _textureView; slim dx version 4.0 13.43
// Main loop while (true) { // Clear the screen var renderTarget = _swapChain.GetBuffer<Texture2D>(0); var context = _device.ImmediateContext; context.ClearRenderTargetView(renderTarget, Color.CornflowerBlue); context
// Draw a sprite var sprite = new Vertex[4] { new Vertex(new Vector3(-0.5f, -0.5f, 0), new Vector2(0, 1)), new Vertex(new Vector3(0.5f, -0.5f, 0), new Vector2(1, 1)), new Vertex(new Vector3(0.5f, 0.5f, 0), new Vector2(1, 0)), new Vertex(new Vector3(-0.5f, 0.5f, 0), new Vector2(0, 0)), }; new[] { new VertexBufferBinding(_device