![]() |
![]() |
![]() |
Text3D Direct3D Sample |
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.
Source: | (SDK root)\Samples\Managed\Direct3D\Text3D |
---|---|
Executable: | (SDK root)\Samples\Managed\Direct3D\Bin\x86\csText3D.exe |
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.
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center