(SDK root)\Samples\Managed\Direct3D\Text3D

This sample shows how to draw 2-D text in a 3-D scene. This is useful for displaying statistics or game menus, for example.

Text3D sample

Supported Languages

  • C#

Path

Source: (SDK root)\Samples\Managed\Direct3D\Text3D
Executable: (SDK root)\Samples\Managed\Direct3D\Bin\x86\csText3D.exe

Programming Notes

This sample uses the Font class to display 2-D text in a 3-D scene. The class uses Microsoft Windows Graphics Device Interface (GDI) to load a font and output each letter to a bitmap. That bitmap, in turn, is used to create a texture.

When the DrawText function is called, a vertex buffer is filled with polygons that are textured using the font texture created as mentioned above. The polygons may be drawn as a 2-D overlay which may be useful for printing statistics.

The sample also creates a 3-D mesh of a text string and renders it.