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

Author Topic: why does setActive() return false  (Read 1297 times)

0 Members and 1 Guest are viewing this topic.

Breakfaster

  • Newbie
  • *
  • Posts: 6
    • View Profile
why does setActive() return false
« on: September 28, 2015, 09:41:53 am »
Hi everyone

i have a problem rendering in a separate thread. Before i start digging everything upside down i hope i just missed something :-) maybe its an easy issue but i'm unable to find an answer in the docs, so for short:

1.
in a separate thread i
- construct a sf::Text, load a font file into it
- construct a sf::RenderTexture and create it to be able to draw stuff on it
- call setActive(false) on the RenderTexture as i read in the docs that i should do that before handing it over to another thread.

after that is done(!), in another thread (main thread actually) i
- call setActive(true) on the RenderTexture
- draw the sf::Text object on it.
- throw the RenderTexture on main window, main-window is constructed in main thread _before_ the separate thread starts.

result:
setActive(true) returns false.
the RenderTexture appears on main window, but without the Text, only its background-color.
There is no error message.

When i do the same stuff in a single thread the little text appears as it should, and even the setActive's i wouldn't need here return true.

what do i fail here? Do i need to deactivate something in the Sf::Text also?


before you ask: I want render stuff in a separate thread because here and there i do intesive calculations (generating animations etc), which otherwise would freeze the displaying thread.


cheers
breakfaster

 

anything