Slim Dx Version 4.0 13.43 _best_ -
context.PixelShader.SetShaderResource(0, _textureView); context.Draw(4, 0);
public Vertex(Vector3 position, Vector2 texCoord) { Position = position; TexCoord = texCoord; } } } This example creates a window, loads a texture, and renders a sprite using the texture. Make sure to replace "texture.png" with the path to your own texture file. slim dx version 4.0 13.43
using SlimDX; using SlimDX.Direct3D11; using System; context
context.InputAssembler.InputLayout = InputLayout.FromDescription(_device, typeof(Vertex), new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0), new InputElement("TEXCOORD", 0, Format.R32G32_Float, 12, 0) }); class Program { private static Device _device; private
This example demonstrates how to load a texture and render a sprite using Slim DX 4.0.
class Program { private static Device _device; private static SwapChain _swapChain; private static Texture2D _texture; private static ShaderResourceView _textureView;
// 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)), };