Skip to main content
gamedev.net
🔒 Locked

DrawText Z Ordering?

Started by PersonGuy Feb 23, 2005 at 5:37 PM 3 replies 650+ views
Original Post
PersonGuy
PersonGuy
I'm using text for a windowing menu system, so there can be several text objects drawn on several Z layers. It seems to draw on top no matter what I do. Is it possible to set the Z value of text drawn through the DrawText call?
circlesoft
circlesoft
Considering that ID3DXFont::DrawText() only takes a RECT input for position, I don't think that it's possible. You could sort the text before you render it, though. This way, lower-layered text gets drawn first, then gets overlayed by higher-layered text.
turnpast
turnpast
If you wrap you DrawText in a Sprite's Begin/End block and pass the sprite as the first param to DrawText changes to the sprite object will effect your text. There are a number of things you can do and it will probably take some playing with but setting the transform to a translation on the Z and using the SortDepthBackToFront and AlphaBlend flags ought to work.

hope this helps.
PersonGuy
PersonGuy
That's useful, but not exactly what I'm looking for. I need the text to more than just sort amongst itself. It needs to write and test Z values so that one menu with text could overlap another menu with text. Thanks for the idea though. Any other thoughts?
The Frugal Gourmet
The Frugal Gourmet
Quote:
Original post by PersonGuy
That's useful, but not exactly what I'm looking for. I need the text to more than just sort amongst itself. It needs to write and test Z values so that one menu with text could overlap another menu with text. Thanks for the idea though. Any other thoughts?


You're just going to have to draw them in the order you want them yourself. Even if you write your own text class that does do z-buffering, your alpha blending is still going to be order dependent.
Co-creator of Star Bandits -- a graphical Science Fiction multiplayer online game, in the style of "Trade Wars'.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.