ID3DXFont...Clipping?

Started by
2 comments, last by Supernat02 20 years, 2 months ago
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
Chris ByersMicrosoft DirectX MVP - 2005
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.
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
Chris ByersMicrosoft DirectX MVP - 2005
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.

This topic is closed to new replies.

Advertisement