Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Font not loaded  (Read 2844 times)

0 Members and 1 Guest are viewing this topic.

1aam2am1

  • Newbie
  • *
  • Posts: 13
    • View Profile
Font not loaded
« on: June 22, 2017, 11:56:53 pm »
When I first create sf::Font object and then use this font for many sf::Text objects.
Next I draw them(main thread)
Next to main thread I launch (resource loading thread), where sf::Font is loaded.
The bug is if the text was first drawn. Then even when we load font, nothing is drawn.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: Font not loaded
« Reply #1 on: June 23, 2017, 12:44:34 pm »
IIRC you need to re-setFont on the text objects if you change the font.
Additionally loading the font in a separate thread isn't really adviced. OpenGL isn't multithreaded and you need to synchronize the font object, making the threaded loading pretty much pointless.
If you do run into performance issues due to loading, I recommend you just load the file from disk into memory in a separate thread and the call loadFromMemory in the main thread.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

1aam2am1

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Font not loaded
« Reply #2 on: June 24, 2017, 10:48:41 pm »
I want oryginalny load textures and sound. In thread pool. And this happened due to testing buttons witch text in the main thread. The issue is can't the code in sf::Text ensure that event if the font is set but not loaded the m_geometryNeedUpdate will be false. This is very simple to code event is current api.

 

anything