Problem with drawing fonts

May 8, 2013 at 11:15 AM
I use sample function from documentation drawText( , ). If fonts are rendering rest of scene not. I drop functiun drawText after drawing objects, before directx method Present(). Only a fraction of a second i see correct scene :
After this all the time i see :
May 8, 2013 at 11:28 AM

Try using the FW1_RESTORESTATE flag as the last parameter to DrawString. In order to draw text the wrapper replaces render-states such as blend-state and vertex-buffers. If the flag is used, then the original states are restored before DrawString returns.

Another alternative is to move any SetVertexBuffer/SetShader etc. calls that you do in your init-function into the main loop, so that they are set each frame.
May 8, 2013 at 11:34 AM
Now its work, but i have only few FPS :(
May 8, 2013 at 11:46 AM
Edited May 8, 2013 at 11:47 AM
Much fewer than when not rendering fonts?
How many strings do you use?
Try downloading the samples under Downloads and run one of the simple ones to see if that also has low FPS. I've never noticed any significant impact when rendering less than hundreds of strings / characters, though of course it can depend on your graphics card and how large the characters are, if pixel fillrate is a problem.
May 8, 2013 at 12:17 PM
Unnecessarily I create per frame new IFW1FontWrapper and IFW1Factory. Now work good. I have last question. How to set depth of fonts? All my objects obscure fonts.
May 8, 2013 at 12:21 PM
It was enough to give drawText elsewhere. Now work fantastically. Fanks for quick answer ;)) !