It's not a problem, it's how SFML 2 work. You have to create an OpenGL context in threads other than the main one if no window is active. That's why the sf::Context class exists.
My problem is that there is no thread (even the main one) that do not call window::SetActive. The two threads share the same context and use it.
I guess this design is not compatible with the library.
here is an example:
window is an sf::Window and global to the 2 thread.
Thread 1
t = 1 | window creation
t = 2 | window->SetActive(true);
t = 3 | opengl calls..
t = 4 | opengl calls..
t = 5 | window->SetActive(false);
t = 6 | some non graphic stuffs...
t = 7 | some non graphic stuffs...
t = 8 | some non graphic stuffs...
t = 9 | some non graphic stuffs...
t = 10| window->SetActive(true);
with no dummy context in thread 2, this fails too.t = 11| opengl calls..
Thread 2
t = 1 |
need a dummy context here.t = 2 | some non graphic stuffs...
t = 3 | some non graphic stuffs...
t = 4 | some non graphic stuffs...
t = 5 | some non graphic stuffs...
t = 6 | window->SetActive(true);
t = 7 | opengl calls..
t = 8 | opengl calls..
t = 9 | window->SetActive(false);
with no dummy context this failst = 10| some non graphic stuffs...
t = 11| some non graphic stuffs...