Connect with us

The Tokusatsu Network

The Tokusatsu Network

CSM Faiz Driver NEXT Available For Preorder

Slim Dx Version 4.0 13.43 |link| -

Here's a useful piece of code to get you started:

// 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); }

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) }); slim dx version 4.0 13.43

static void Main(string[] args) { // Create the device and swap chain var windowHandle = System.Windows.Forms.Application.OpenForms[0].Handle; var desc = new SwapChainDescription() { BufferCount = 1, IsWindowed = true, ModeDescription = new ModeDescription(800, 600, new Rational(60, 1), Format.R8G8B8A8_UNorm), OutputHandle = windowHandle, SampleDescription = new SampleDescription(1, 0), Usage = Usage.RenderTargetOutput };

// Main loop while (true) { // Clear the screen var renderTarget = _swapChain.GetBuffer<Texture2D>(0); var context = _device.ImmediateContext; context.ClearRenderTargetView(renderTarget, Color.CornflowerBlue); Here's a useful piece of code to get

context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip; context.InputAssembler.SetVertexBuffers(0, new[] { new VertexBufferBinding(_device, sprite, 0) });

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. _texture = textureData

class Program { private static Device _device; private static SwapChain _swapChain; private static Texture2D _texture; private static ShaderResourceView _textureView;

slim dx version 4.0 13.43slim dx version 4.0 13.43

Categories

Newest Posts

Subscribe to TokuNet

Enter your email address to subscribe to the Tokusatsu Network and receive notifications of new posts by email.

To Top