Skip to content

Getting Started

Chuck Walbourn edited this page Mar 26, 2019 · 53 revisions

This is the Getting Started tutorial for DirectX Tool Kit which introduces the reader to programming Direct3D 11 in C++.

If you are looking to use DirectX 12 and are already familiar with Direct3D 11, the place to start is the DirectX Tool Kit for DirectX 12 tutorials. Keep in mind that DirectX 12 is an expert API which builds on knowing the ins & outs of DirectX 11, and is an unforgiving API to developers new to Direct3D or graphics in general. 15


This tutorial assumes the reader is familiar with the basics of C++ programming using Microsoft Visual C++, including writing code, building applications, and basic debugging. Coding conventions here will make use of C++11 language features such as nullptr, auto, simple lambdas (aka anonymous functions), and the standard smart-pointer std::unique_ptr / std::make_unique<T>(), but will generally be otherwise 'core' C++.

This tutorial does not assume prior experience with Direct3D, but the reader should be familiar with the basic graphics concepts for DirectX or OpenGL. That said, you can get a long way using DirectX Tool Kit without much in the way of graphics experience.

Note that Direct3D 11 and DirectX Tool Kit are not Windows Runtime (aka "WinRT") components, so we do not make use of the C++/CX language extensions or the /ZW switch. DirectX Tool Kit is a 'pure' C++ library, which is why it's not directly usable by Visual Basic, C# or HTML+JavaScript applications.

Error handling

One thing that many C++ developers, particularly game developers, may not be all that familiar with is "C++ Exception Handling". This is distinct from "Structured Exception Handling" (SEH) which some developers have seen in the past, and can leave an unfavorable impression of C++ EH. On both ARM and x64 native platforms, C++ EH is very efficient, although the x86 32-bit implementation does have some quirks. In any case, DirectX Tool Kit uses C++ Exception Handling for most error conditions, just as the Standard Template Library (STL) does and the standard behavior of the operator new.

For debugging exceptions thrown by the DirectX Tool Kit, you should enable the checkbox next to std::exception in the Visual Studio Exception Settings dialog (Debug -> Windows -> Exception Settings). It's not on by default. Then select the "C++ Exceptions" line, click the PLUS button, and type DirectX::com_exception to add that one. If working with the Direct3D VS Game templates you should do this once more typing DX::com_exception.

Exception Settings

For some more detail on how the Visual Studio debugger deals with exceptions, read this blog post.

In Visual Studio 2015/2017, the exception debugging options changed compared to VS 2013; see this blog post.


These tutorials are written with game development in mind as the target application since games are an excellent fit for the 'immersive DirectX app' model. Keep in mind, however, that the majority of the functionality in the DirectX Tool Kit is applicable to DirectX graphics programming in general for both game and non-game applications.

Software Setup

For learning purposes, these instructions are going to focus on the following setup:

  • Visual Studio 2015 Update 3 or Visual Studio 2017 (15.7 update or 15.8 update) Community, Professional, Premium, or Ultimate
  • Windows 7 Service Pack 1, Windows 8.1, or Windows 10

We will be using a Win32 desktop application project template in order to support developers using Windows 7, but all these techniques and APIs apply to Universal Windows Platform apps and Xbox One as well.

There is no need to install the legacy DirectX SDK to use DirectX Tool Kit. The DirectX SDK is deprecated and you should not use it. The only time you would need to install the legacy DirectX SDK for this tutorial series is if you are using Windows 7 for the audio portions. See Microsoft Docs, DirectX SDK Samples Catalog, and DirectX SDK Tools Catalog.

Visual Studio 2015

Be sure to install Visual C++ which requires using the Custom install as it's not part of the Typical install. See the Visual C++ Team Blog for details.

Visual Studio 2017

When using the new lightweight installer be sure to select the appropriate workloads. Here are the recommended options to select:

  • Workload: Game development with C++
  • Workload: Desktop development with C++
  • Workload: Universal Windows Platform development
  • Optional component: C++ Universal Windows Platform tools

Note that Xbox One XDK developers also need to include the optional component Windows 8.1 SDK and UCRT SDK


For a quick introduction to DirectX 11 programming, take a look at the Introductory Graphics samples on Xbox-ATG-Samples.

  • Basic drawing: SimpleTriangle
  • Basic texturing: SimpleTexture
  • Basic lighting: SimpleLighting
  • DirectCompute: SimpleCompute
  • Tessellation: SimpleBezier
  • Instancing: SimpleInstancing
  • Multisample Antialiasing: SimpleMSAA







Dual-use Coding Techniques for Games
C++ Core Guidelines

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 10
  • Windows 8.1
  • Windows 7 Service Pack 1
  • Windows Vista Service Pack 2 with KB971644
  • Xbox One

For Development

  • Visual Studio 2017
  • Visual Studio 2015
  • Xbox One XDK

Related Projects

DirectX Tool Kit for DirectX 12




Content Exporter


Clone this wiki locally
You can’t perform that action at this time.