Direct3D9 Tutorials in .Net

My primary goal in doing these tutorials is to learn. By developing these tutorials I hope to learn my way around Direct3D (not to mention .Net) much quicker than I would otherwise. Also I hope to be able to provide a valuable resource for others who want to learn.These examples may not always illustrate the best way to do things. I'm (mostly) human and fallible. I'm open to (constructive) criticism, if you have a better way of doing something, let me know.

These tutorials primarily cover Direct3D9, though other bits (notably DirectInput) maybe be covered to some degree. The DirectX SDK is required to compile them. The original tutorials are written in C#, but I avoid using complex features of the language. I'm fairly new to the language myself so I welcome constructive feedback on my use of the language. The VB.Net versions were written by someone who knows the language well, but feedback is always welcome on ways to improve them.

For further help I highly recommend the very active community at

Version Note

These tutorials have been tested with the August 2005 version of the DirectX9 SDK. Minor changes may be required to the code if you are using a different version.

Frequently Asked Questions that often come my way. Just to be nice, I provide some answers too!
Tutorial FAQQuestions regarding my tutorials
Direct3D FAQQuestions regarding Direct3D in general

The Basics
How to open a display and render simple things to it.
Windows PrimerHow to create a window and handle basic messages
Windows Primer 2How to create a window and handle basic messages using a more Object Oriented approach
Initializing Direct3DInitializing Direct3D and creating a Direct3D Device.
3D PrimerA brief discussion of vertices and other concepts with code examples
The Message LoopA more efficient Message Loop.
PointsHow to cover your display with lots and lots of dots
LinesThe shortest path between 2 points is a straight line. Here's how to draw some.
TrianglesFans, Strips and Lists
Vertex BuffersNow that you can render the basic primitives, here's how to do it faster.
Vertex Buffers - Custom Vertex FormatCreating and using your own custom vertex format
Model SpaceRendering an object defined in Model Space
World TransformTranslation, Rotation and Scaling
3D ObjectsSo far we've only rendered flat 2-dimensional objects. Now we'll render real 3D objects