Jump to content
  • Advertisement

Archived

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

Supernat02

ID3DXFont...Clipping?

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

Hi, I am rendering text to windows in D3D9, but my problem is that if one window overlaps another window, the text from both windows appears on top. I didn''t see a way to change the depth of the text, tell me if I''m wrong. Am I going to have to use the clipping rectangle to clip the text on all of the inactive windows or is there another way to do this? Should I go into the effort of rendering the text to a texture everytime the text changes (shouldn''t be that often), and just apply the texture instead? I figure this would cut down on cpu time as well as allow for depth. I''m using transformed vertices for the windows. Any suggestions are welcome. Thanks, Chris

Share this post


Link to post
Share on other sites
Advertisement
I am working on a font engine right now. Not my most favorite thing to do but very necessary. If you draw from back to front, the active window should cover up the old window, right? I take it you are using LPD3DXFONT right now? The ''depth'' of the font is just the order your render it. Turn off the depth buffer for this 2D rendering.

Share this post


Link to post
Share on other sites
Well, I was doing something wrong. I was rendering all of the windows, then all of the text from every window. I changed that and render the window, then it''s text, then the next window, starting with the window on the bottom and moving up to the topmost window. Sadly, it still drew the text on top of each other. I am using a D3DXSprite to optimize the rendering too, and that is what''s getting me. I disabled the sprite and just starting drawing text as it should and it works now, but at an increase in cpu usage. Oh well, I''ll go see if D3DXSprite has some flag I can set to make it work.

Thanks for the quick response!
Chris

Share this post


Link to post
Share on other sites
All Draw Text are bathched/queued into the specified ID3DSPrite, until a call to ID3DSprite::Flush() is done. End() call Flush().

Try to call pSprite->Flush() after every window.

Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE) set some renderstate you may not want for other stuff rendered inside your windows. So i suggest you call the Begin/End for every window instead of the Flush solution.

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!