Text rendering and "slow motion game". RRS feed

  • Question

  • Hello.

    I have a problem with my class to render the text with a speed of running a game. When I render about 20-30 lines of text in one frame, a speed goes down radically. I use CreateTextFormat and DrawText functions. Is there a way to improve speed of my game. The FPS goes down from 60 to ~30. Thank you for any help.

    Tuesday, December 2, 2014 12:35 AM

All replies

  • Have you tested to use this two functions in a simple project and was the problem persisting?

    Wednesday, December 3, 2014 3:16 AM
  • You should not need to call CreateTextFormat every frame... Just re-use the same IDWriteTextFormat object.

    Another alternative is using SpriteFont in the DirectX Tool Kit.

    Wednesday, December 3, 2014 8:14 AM
  • I use create textformat only one time, when a initialize my class, the i use one drawtext in one frame, but in case when i use this function propably ~30 times per frame FPS going down quickly. In simple project of course there is no problems, but i need  some text in my game.
    Wednesday, December 3, 2014 6:06 PM
  • In simple project of course there is no problems,

    A simple project should have high performance (speed) comparing with the game you mentioned. By comparison, the performance cost of drawing the texts may be not so significant for a simple project. So, it is possible that, it SEEMS that there is no problem in a simple project.

    Are the texts changed every frame?

    • Edited by kwikc Thursday, December 4, 2014 3:40 PM
    Thursday, December 4, 2014 3:26 PM
  • Of course, I understand, that in simple projekt, it can be, that there won't be any problems. Most of the rendering text isn't change, but some of them is updated per frame.
    Saturday, December 6, 2014 1:37 AM
  • Drawing texts could be time consuming tasks. For the texts that are not changed every frame, it may pre-draw them on a texture at the initial stage then render the texture at the running time.

    As far as I know, FPS value is not a good ruler for performance measuring.

    You may consider posting the question on the forums focused on game development. There are usually some gurus hovering there; you can expect to get a lot of information from the angle of game programming but only Windows platforms.

    Saturday, December 6, 2014 6:56 PM
  • I found a some type of solution for my problem http://directxtk.codeplex.com/wikipage?title=SpriteFont&referringTitle=Home, but I have a problem with a *.spritefont, because I don't know how can I get it? Can anybody help me?

    Tuesday, December 9, 2014 2:19 AM