I'm a bit confused. So what I need to do is make an empty texture and draw the circles on it?
Could you link a tutorial or an example, please. Thank you.
Again, if your circles do not move, yes, you can draw them to a kind of texture and then draw that texture in one draw call. However, if your circles are moving/changing, you'll still need at least as many draw calls (to draw them to the texture).
Basically, set up an sf::RenderTexture to match the window size and draw the circles to that in the same way you draw to a window (and prepare the sprite that draws the render texture):
std::vector<sf::CircleShape> circles;
sf::RenderTexture renderTexture;
// set up render texture and circles
renderTexture.clear();
for (auto& circle : circles)
renderTexture.draw(circle);
renderTexture.display();
sf::Sprite renderSprite(renderTexture.getTexture());
This can be done before the main loop since they are not changing.
Also, you no longer need the vector of circle shapes...
Then, in the main loop where you are drawing to a window, just draw the render sprite:
while (window.isOpen())
{
// event loop
// updates
window.clear();
window.draw(renderSprite);
window.display();
}