Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Donovan

How do I render 2d text on the z axis

This topic is 5279 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!