1
Graphics / Thread separation
« on: November 11, 2019, 11:57:07 pm »
Hello,
I want to separate the game logic and rendering in two individual threads. Essentially the game logic will be responsible for modifying the SFML drawables (like changing position or color) and the rendering thread will of course perform the rendering. I will guard against thread collisions through an immutable facility (i.e. the render thread will be reading objects that provably cannot change).
I browsed the sources and this seems feasible because it seems to me that when for example setting the position of a shape, SFML does not perform any opengl calls.
Hence my question is: is this separation guaranteed by the SFML design or this just applies to certain functions only?
Edit: To phrase it differently in case it helps: does SFML invoke opengl calls on objects on the draw call only, or also when modifying the objects properties also( like position, color, etc). I am interested both about shapes and views.
I want to separate the game logic and rendering in two individual threads. Essentially the game logic will be responsible for modifying the SFML drawables (like changing position or color) and the rendering thread will of course perform the rendering. I will guard against thread collisions through an immutable facility (i.e. the render thread will be reading objects that provably cannot change).
I browsed the sources and this seems feasible because it seems to me that when for example setting the position of a shape, SFML does not perform any opengl calls.
Hence my question is: is this separation guaranteed by the SFML design or this just applies to certain functions only?
Edit: To phrase it differently in case it helps: does SFML invoke opengl calls on objects on the draw call only, or also when modifying the objects properties also( like position, color, etc). I am interested both about shapes and views.