Jump to content
  • Advertisement
Sign in to follow this  
red_sodium

Drawing ID3DXFont in front of the camera

This topic is 5147 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

Hey, Just wondering how I'd use ID3DXFont::DrawText to draw the text at a constant position on the screen, rather than in world co-ordinates. The camera will move around in 3D, but my text must remain centred on screen. Is there a way of disabling all transformations done on it by the projection matrix (i think) other than manually reversing what is done implicitly by DirectX (i think), like with ID3DXSprite you can flag it to go as D3DXSPRITE_OBJECTSPACE or not. Oh yeah, I am using my sprite interface to draw the text with, through ID3DXFont::DrawText(). Do I need a seperate sprite interface that doesn't have the D3DXSPRITE_OBJECTSPACE flag selected? Thanks for your help!

Share this post


Link to post
Share on other sites
Advertisement
Red,

Take a look through the SDK for the ID3DXSprite class and learn how to use it inside and out ^_^. This will make your life so much easier than trying to do it through transformations. Another option would be to set your world space transforms (such as view and projection), render your world using world space, and come time to render your text set an Orthographic projection -- D3DXMatrixOrthoLH() and reset your world and view to the defaults and set the porojection using the ortholh method:

OrthoLH Function

This will force anything drawn after it to a 2D plane which should always be facing the camera....I've implemented my entire HUD in my FPS this way and seems to be working out well so far.

Permafried-

Share this post


Link to post
Share on other sites
Although i'm more an OpenGL coder i use the Projection matrix to this kind of things and screen coordinates

Share this post


Link to post
Share on other sites
Sign in to follow this  

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