Direct3D Programming Tip #1: Getting Started

Inspired by Sara Ford’s Visual Studio Tips, I thought I would start writing a series of tips for Direct3D programmers. I doubt I will be able to be as prolific as Sara, with a new tip each and every single day.

So where do we start? Let’s start with the very basics for a native Direct3D programmer. You will need:

  • A C++ development environment.
  • A DirectX SDK.
  • A version control system.

Once you have these in place, you’re ready to get started writing your own Direct3D programs.


A C++ Development Environment

Visual Studio

Download a free copy of Visual C++ 2008 Express Edition.

The license allows you the freedom to develop and sell anything you create with it. The compiler is the same as the commercial compiler, including all the optimizations available. The current DirectX SDK supports the 2005 and 2008 editions Visual Studio only, so avoid earlier compilers and in particular avoid Visual C++ 6.

Visual Studio Add-Ins

The express editions of Visual Studio don’t support add-ins. Add-ins are tools that allow expansion of the capabilities of the integrated development environment provided by Visual Studio. There are add-ins that integrate with version control systems, improved intellisense and refactoring tools. These are only supported by the commercial editions of Visual Studio.

If you have a commercial edition of Visual Studio, I recommend that you download the free add-in Refactor! for C++.

This add-in provides simple refactoring support for C++ programmers, giving you the ability to easily rename identifiers, extract statements into their own method or function, move implementations between header and source files and more.

A DirectX Software Development Kit

The DirectX SDK provides the additional header and library files need to write Direct3D programs. Visual Studio ships with enough header and library files that you can write basic programs against the Win32 API. It lacks the headers and libraries for accessing the most recent features of DirectX. Microsoft improves the DirectX SDK continuously and releases a new version of it every few months, usually quarterly.

Download the most recent DirectX SDK from Microsoft’s DirectX Developer Center.

The SDK includes headers, libraries, and documentation. Also included are sample programs and models that demonstrate various visual effects implemented with Direct3D. Its recommended that you use the most recent version of the SDK for your applications.

After installing the SDK, you’ll want to check the search locations for headers and libraries to make sure the DirectX headers and files are found by the compiler. Check the settings for include files and library files and make sure that the appropriate directory for the DirectX SDK is listed first in the search order at the top of the list box. If the DirectX SDK directories are not listed first, it can lead to compilation errors.

After launching Visual Studio, select Tools / Options… from the menu and browse to the Projects and Solutions / VC++ Directories section in the tree view. On the right is a combobox showing the kind of file searched for in the paths shown in the list box:

Includes

A Version Control System

This is one that is overlooked by most beginners to Direct3D and game programming. You’ll want a version control system so that you can track your changes to your code. At the very least it serves as a backup for your source code. At best you’ll find that it lets you quickly back out of a large sequence of changes that just didn’t work out. Backing your way out of a dead end with a version control system is a very handy thing to have around.

There are a variety of version control systems out there and Wikipedia has a good list summarizing them. One that is very popular with commercial and open source programmers is Subversion. My first version control system was RCS when I was working on the X Server for a RISC workstation designed at Evans & Sutherland. Later, we switched to CVS, which was built on top of RCS. For a brief while, I used Visual SourceSafe, but it is generally considered to be an inferior version control system. (Even Microsoft doesn’t use that internally.)

I recommend that you download TortoiseSVN to use subversion.

TortoiseSVN is a subversion client that integrates nicely with the Windows shell. It adds an overlay to a file’s icon that shows its modified state with respect to the subversion repository. This makes it very handy and intuitive to see which files you have changed but not yet committed to version control.

8 Responses to “Direct3D Programming Tip #1: Getting Started”

  1. Alessandro Says:

    For those using CVS, there is also the TortoiseCVS. Like his counterpart for SVN, TortoiseCVS works integrated to Windows Explorer.
    To avoid the maintenance problems with servers, you can use a external server, as Assembla dot com

    Like

  2. Adrian Chen Says:

    Thanks a lot. Look forward to your more articles.

    Like

  3. Hashim Says:

    Concise and to the point. Thanks a lot.

    Like

  4. Jesse Wattenbarger Says:

    In line with Alessandro’s suggestion and the original author’s suggestion, I’d like to recommend TortoiseGit. It’s also integrated with Explorer, very similar to the other Tortoise* programs, but Git is different than CVS and SVN in that it is “distributed” version control. You don’t need server to push to. You can save all your local changes quickly and easily from your dev directory. Though, I still recommend pushing your dev directory out somewhere (for backup at the very least).

    Like

  5. Sergio Says:

    In VS2010 there are no longer visual C++ include folder settings in Tools>Options. This is not really a Direct3D version, but does anyone knows where is that property sheet that VS2010 talks about replacing those?

    Like

    • legalize Says:

      Yes, I learned about this recently. If you go to Tools / Options… in VS2010, there is a link there that takes you to the appropriate help section for VS2010 that describes how to configure it using the new per-user property sheets.

      To configure the property sheets for debug and release configurations, you need to load a C++ project into VS2010 and then do View / Other Windows / Property Manager. From there you should be able to create the appropriate settings on the per-user property sheets for the different configurations.

      Like

  6. RolanDecoy Says:

    I assume that the Windows SDK (which now contains the DirectX SDK) is compatible with previous versions…???

    Like


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: