The DirectXTex library does an excellent job of providing all the 'texture content processing' functionality from the venerable D3DX library (see "Where is the DirectX SDK?"), and DirectXMath (or the older XNAMath) takes over for D3DXMath. Shawn Hargreaves and I have been putting together another utility library, dubbed "DirectX Tool Kit" or "DirectXTK", to address some additional runtime needs for Direct3D 11 applications.

DirectXTK includes the following components: 

  • SpriteBatch - a 2D sprite rendering class (a C++ version of the SpriteBatch used for XNA Game Studio)
  • SpriteFont - a bitmap based text rendering (a C++ version of the SpriteFont used for XNA Game Studio)
  • Effects - a collection of ready-to-use common shaders (C++ versions of the BasicEffect, AlphaTestEffect, DualTextureEffect, EnvironmentMapEffect, and SkinnedEffect used for XNA Game Studio)
  • PrimtiveBatch - simple and efficient way to draw user primitives which replicates the simplicity of the Direct3D 9 era DrawUP APIs
  • GeometricPrimitives - geometry helpers for common shapes (Cube, Sphere, GeoSphere, Cylinder, Torus, Teapot, Tetrahedron, Octahedron, Dodecahedron, and Isosahedron)
  • Model - draws simple meshes loaded from .CMO or .SDKMESH files
  • CommonStates - Factory for common combinations of rendering states as Direct3D 11 state objects (C++ versions modelled after the 'public fields' of BlendState, DepthStencilState, RasterizerState, and SampleState classes used for XNA Game Studio)
  • VertexTypes -  collection of commonly used vertex buffer data structures with a input layout descriptions (C++ versions of VertexPositionColor, VertexPositionTextureVertexPositionColorTexture, and VertexPositionNormalTexture structures used for XNA Game Studio)
  • It also includes DDSTextureLoader,  WICTextureLoader, and ScreenGrab from the DirectXTex package.
  • SimpleMath - a wrapper for DirectXMath that makes it easier to write basic math operations without as many restrictions as the SIMD-friendly base library
  • And the MakeSpriteFont utility for generating .spritefont files (based on the Bitmap Font Maker Tool for XNA Game Studio)

This library can be used for Windows 8/Windows 7/Windows Vista Direct3D 11 Win32 desktop applications as well as Windows Store apps (a.k.a. Metro style apps).

The code requires either Visual Studio 2012 or VS2010 with the new Windows SDK as it makes use of DirectXMath and the new SAL2 annotations.

The README.TXT in the ZIP package contains additional information, and see Shawn's posts here and here with some code snippets for usage.

Porting Notes

Here's a handy table of equivalents for D3DX (see Living without D3DX for a complete listing):

ID3DX10Sprite

SpriteBatch

ID3DX10Font

SpriteFont, SpriteBatch

ID3DX10Mesh

Model, ModelMesh, ModelMeshPart

D3DXCreateBox
D3DXCreateCylinder
D3DXCreateSphere
D3DXCreateTeapot
D3DXCreateTorus

GeometricPrimitive

D3DX11CreateShaderResourceViewFromFile

CreateXXXTextureFromFile

D3DX11CreateShaderResourceViewFromResource
D3DX11CreateShaderResourceViewFromMemory

CreateXXXTextureFromMemory

D3DX11CreateTextureFromFile

CreateXXXTextureFromFile

D3DX11CreateTextureFromResource
D3DX11CreateTextureFromMemory

CreateXXXTextureFromMemory

D3DX11SaveTextureToFile

SaveXXXTextureToFile

Where XXX is "DDS" for working with .DDS files, or "WIC" for working with WIC-supported bitmap image formats such as .BMP, .JPG, .PNG, etc. Note that .TGA is supported by legacy D3DX and by DirectXTex, but not by DirectXTK.

Note

Update: DirectXTK is now hosted on Codeplex. The latest version of the library, documentation, notes on future work, release history, and other information is now available there. The library now includes PrimitiveBatch and Model as well.

Windows phone 8: DirectXTK supports Windows phone 8 apps using the Windows phone SDK 8.0. See ShawnHar's post.