• Create Account

D3DXFont Z-Positioning

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

#1Juliean  GDNet+

6212
Like
0Likes
Like

Posted 27 February 2013 - 01:51 PM

Hello,

I want to use the D3DXFont to draw some texts for my DX9-driven level-editor. Only problem: The text always appears at the top of everything (2d rendering only), no matter what I do. Kind of what you expect since DrawText() doesn't use any "z"-related parameter. I've already set up a working Front-to-back ordered render using the D3DXSPRITE-interface, which I'm also using for the font-rendering:

m_lpFont->DrawText(m_lpD3DSprite, lpText, -1, &winRect, 0, m_Color);


Any chance to order the text to a certain z-value? Maybe some setting for the sprite? If possible I would want to be able to do this without having to render out the sprite (text is drawn all over the place in the code and using only one draw()->end() - sequenz is significantly faster). Any ideas?

Edited by The King2, 27 February 2013 - 01:52 PM.

#2blueshogun96  Members

2166
Like
1Likes
Like

Posted 28 February 2013 - 01:43 PM

I personally prefer to avoid ID3DXFont when possible.  Instead, I wrote my own texture based font class and was ultimately happier using it.  This way, I could have more control over my code and even z-ordering if necessary.

This link does a decent job of explaining how it's done: http://cboard.cprogramming.com/game-programming/70990-font-rendering-direct3d.html

If you want, I can share mine.  ^^

Shogun.

Follow Shogun3D on the official website: http://shogun3d.net

"Yo mama so fat, she can't be frustum culled." - yoshi_lol

"One objection to a “critique of C#” would be that you can’t talk about C# without talking about the whole “.Net experience”. However, one can approach the topic of Hitler without a complete discussion of Nationalist Socialism, so I feel justified." - Steve White.

#3Juliean  GDNet+

6212
Like
0Likes
Like

Posted 01 March 2013 - 08:52 AM

Thanks for the advice, I'll definately have a look at it,

but I managed to solve the ID3DXFont myself so for now I'm going to stick with it (I want to invest my time into other areas first). The problem was that first of all I forgot to set the ID3DXSprite-Object for my Font-class so it would draw with "NULL", and therefor without a sprite when calling DrawText. That way the transform didn't get applied to at all. With this fixed just setting an identity-matrix and calling "m_mTransform(3,2) = z;" before setting the transform, everything works just fine.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.