Text Directx 8

Started by
5 comments, last by nanobyte 22 years, 8 months ago
What is the easiest way to draw text in Directx 8? Is it possible to use the windows gdi function? If so how? Thanks
Advertisement
Look for some other posts about this...

You could use gdi, BUT YOU DON''T WANT TO!!!!

look through the SDK samples that use fonts. Essentially, they use gdi ONCE to draw an alphabet to a texture and then they use that texture to render sets of textured quads. You can either use their font class, or derive your own.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Look in the samples for the CD3DFont class. It does 2D or 3D text. There is one example called "3D Text" that show how to use it.

there is a font class in D3DX thats given with the sdk..

its quite easy to use.

D3DXFONT class ..



{ Stating the obvious never helped any situation !! }
HDC hdc;
lpdds->GetDC(&hdc);
DrawText(&hdc, //blah blah blah);
lpdds->ReleaseDC();
Oh Dear God!!!

Don''t use the GDI method!!!!
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
D3DXFONT is just a wrapper for some GDI functions so it''s not a way to follow the "Don''t use the GDI method!" advice. But, if you''re just looking at a way to display some temporary debug text (that doesn''t need speed), you could use D3DXFONT just to avoid to play with device contexts.

For in-game text, you should use a texture that hold the alphabet as CrazedGenius said. Simpler : draw the complete alphabet on a bitmap to completely avoid GDI !
alexk7

This topic is closed to new replies.

Advertisement