Jump to content
  • Advertisement
Sign in to follow this  

[SlimDX] Getting started with SlimDX & DirectX 9c

This topic is 2734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I'm trying to learn SlimDX, but I only have XP and DirectX 9c available to me (I know, I know - it's a long story!). Consequently the excellent tutorials are rather hard to follow as they are aimed at SlimDX.Direct3D11.

I have tried to follow along and write the equivalent code (below) aimed at SlimDX.Direct3D9 - with some success as I get a window up, but it aint blue!

Any clues? Or is there a legacy tutorial somewhere aimed at SlimDX.Direct3D9 dinosaurs such as myself?

Here's what I see: http://www.flickr.com/photos/astronomytoolbox/5221607990/

And here's the code that makes those pretty patterns:

static void Main()
RenderForm form = new RenderForm("Tutorial 2: Device Creation");

PresentParameters presentParams = new PresentParameters();
presentParams.DeviceWindowHandle = form.Handle;
presentParams.Windowed = true; // We don't want to run fullscreen
presentParams.SwapEffect = SwapEffect.Discard; // Discard the frames
presentParams.EnableAutoDepthStencil = true; // Turn on a Depth stencil
presentParams.AutoDepthStencilFormat = Format.D24S8; // And the stencil format
presentParams.BackBufferFormat = Format.A8R8G8B8;
presentParams.PresentationInterval = PresentInterval.Default;
presentParams.BackBufferWidth = form.ClientSize.Width;
presentParams.BackBufferHeight = form.ClientSize.Height;

Device device = new Device(
new SlimDX.Direct3D9.Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, presentParams);

SwapChain swapChain = new SwapChain(device, presentParams);

Viewport viewport = new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height);

MessagePump.Run(form, () =>
device.Clear(ClearFlags.Target, new Color4(0.5f, 0.5f, 1.0f), 1.0f, 0);


Share this post

Link to post
Share on other sites
Specifically "program.cs".

Lines 65 through 76 or lines 85 through 96 depending on your revision.

Share this post

Link to post
Share on other sites
Thank you everyone! Works a charm.

I'm going to be using SlimDX to do some surface plots (3D data visualisation) of data in my astronomy application.

Do you have any useful links or info on 3D surface plots, meshing, colourising etc?

Share this post

Link to post
Share on other sites
It's not an area I'm familiar with, in general, but I believe that another user on these forums (GoodFun, maybe?) is doing something similar. You may want to peruse his threads.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!