I'm not sure if you know how capture software work, but what they usually do is injecting themselves into your application and grabbing back buffer directly from your application.
Now if you use multiple threads and multiple windows chances are pretty high that their injection code isn't made for this kind of scenario, I mean which game does use multiple windows to rendering from different threads?
And don't forget that you're using global RenderWindows which itself can in certain cases already create issues. Plus you're not deleting the windows at the end.
Anyways I tried it with Open Broadcaster Software and yes, as soon as I start the preview the application will crash. Since I ran it in debug mode, I got some glCheck error:
An internal OpenGL call failed in Texture.cpp (526) : GL_INVALID_FRAMEBUFFER_OPERATION, the object bound to FRAMEBUFFER_BINDING is not "framebuffer complete"
No idea if that is of any help.
I went ahead and made everything single threaded. This at least didn't lead to any crashes, but OBS still couldn't get an image from it and the capture instead stayed black.
#include <SFML/Graphics.hpp>
bool isRunning = 1;
int main()
{
sf::RenderWindow *window1, *window2;
window1 = new sf::RenderWindow(sf::VideoMode(800, 600), "Awesome window");
window2 = new sf::RenderWindow(sf::VideoMode(800, 600), "Not as awesome window as the first one but still great");
while(isRunning)
{
sf::Event event;
while(window1->pollEvent(event))
{
if(event.type == sf::Event::Closed)
{
isRunning = 0;
}
}
window1->clear(sf::Color::Red);
window1->display();
while(window2->pollEvent(event))
{
if(event.type == sf::Event::Closed)
{
isRunning = 0;
}
}
window2->clear(sf::Color::Blue);
window2->display();
printf("we're alive\n");
}
delete window1;
delete window2;
}
And if I render just one window, either with the multi-threaded or the single threaded code, i.e. just calling clear() and display() on one window, the OBS can capture the rendering and nothing crashes.
My conclusion: Capturing software is not made for this kind of scenario, i.e. multiple window with multiple rendering "loops".
If you really need to windows, you might want to think about splitting up the windows in two applications, maybe then the capture software will again be able to differentiate the rendering.