Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


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.

  • You cannot reply to this topic
2 replies to this topic

#1 Juliean   GDNet+   -  Reputation: 2746

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.


Sponsor:

#2 blueshogun96   Crossbones+   -  Reputation: 1104

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

 

blogger.png twitter.png tumblr_32.png facebook.png

 

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


#3 Juliean   GDNet+   -  Reputation: 2746

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.



PARTNERS