Slim Dx Version 4.0 13.43 ((better)) -
using SlimDX; using SlimDX.Direct3D11; using System;
Device.CreateWithSwapChain(GraphicsAdapter.Default, DeviceCreationFlags.None, desc, out _device, out _swapChain);
context.PixelShader.SetShaderResource(0, _textureView); context.Draw(4, 0); slim dx version 4.0 13.43
// Load a texture using (var stream = System.IO.File.OpenRead("texture.png")) { var textureData = Texture2D.FromStream(_device, stream, ImageInformation.FromFile("texture.png")); _texture = textureData; _textureView = new ShaderResourceView(_device, _texture); }
class Program { private static Device _device; private static SwapChain _swapChain; private static Texture2D _texture; private static ShaderResourceView _textureView; using SlimDX; using SlimDX
struct Vertex { public Vector3 Position; public Vector2 TexCoord;
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. Also, error checking has been omitted for brevity
Keep in mind that you need to have the Slim DX 4.0 libraries and the DirectX SDK installed to run this code. Also, error checking has been omitted for brevity.