Problem with drawing fonts

May 8, 2013 at 12:15 PM
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 12:28 PM

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 12:34 PM
Now its work, but i have only few FPS :(
May 8, 2013 at 12:46 PM
Edited May 8, 2013 at 12:47 PM
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 1: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 1:21 PM
It was enough to give drawText elsewhere. Now work fantastically. Fanks for quick answer ;)) !