Microsoft DirectX 9.0 SDK Update (October 2004)

Text3D Microsoft® Direct3D® Sample

Language:

Note: This documentation is preliminary and is subject to change.

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

Path

Source: (SDK root)\Samples\Managed\Direct3D\Text3D
Executable: (SDK root)\Samples\Managed\Direct3D\bin\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.


© 2004 Microsoft Corporation. All rights reserved. Terms of use.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center