How do I render 2d text on the z axis

Started by
3 comments, last by Donovan 19 years, 10 months ago
Basically, I want to create labels with the character''s names that float over their heads. My problem is that my Managed DirectX book as well as all the online tutorials only seem to cover drawing text in the static x,y coordinates of the screen. I want to be able to take text and move it in the X,Y,Z plane. Can someone help me out please? (thank you in advance!)
Advertisement
When you call ID3DXFont->DrawText(), the first parameter is a pointer to a D3DX Sprite object.

I''m not 100% sure on this, since I haven''t tried it yet, but I believe if you set the sprite''s transform to a billboarding matrix, rather than the default screen space setup, you''ll achieve the desired results.

The SDK has an example of using 3D text using d3dutil framework classes, but those classes don''t operate nearly as fast as ID3DXFont does.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

Thanks man... Makes sense... i''ll give it a go...

I haven''t played with straight sprites yet, I''m still quite new.

Anybody else have any suggestions or know exactly how to do it?
Actually, I''m using C#.net with DX9 and the Microsoft.DirectX.Direct3D.Font -> DrawText() only takes the text, System.Drawing.Rectangle, options, and color.

I don''t know of any way to get this to render the text to another object...

Help please!
Yes - just use textures with your text on them. If your text is dynamic then render the text to a texture. You can then just use that texture with a plane and orient it however you want in your world.

Use black as the surrounding transparent colour of your text (presuming you want the surrounding colour of your text to be transparent) and then you can use alpha-testing to hide the surrounding colour.

This topic is closed to new replies.

Advertisement