Hello,
in the SFML tutorial "Drawing 2D stuff" is at the end a section "Drawing from threads", which explains that you can handle all drawing in a seperate thread.
I don't understand why this is working:
I draw for example a sf::Sprite in the rendering thread
window.draw(sprite);
which calls sf::RenderTarget::draw and then sf::Sprite::draw. In this draw function I'm accessing the sprites data members m_origin, m_position, m_rotation and so on through the call to sf::Transformable::getTransform().
At the same time i can access this data members from the "main game loop" in another thread through calls like sf::Transformable::setPosition(), sf::Transformable::setRotation() and so on.
Aren't I'm accessing the data members then from different threads at the same time? I have nowhere seen a mutex or so, why does this work?