I had the exact same problem and this is how I solved it.
I am not sure exactly what limit you are hitting. It could be that you are using only one
sf::RenderTexture and are hitting the max texture size, or you are using more than one
sf::RenderTexture and are hitting the graphics card memory limit.
If it is the first, you might consider using more than one texture and creating a tiled background image. You would split your background into a 256x256 or 512x512 (or maybe higher) grid and then render each tile that is currently in the view.
for(int x = 0; x < MAP_TILE_WIDTH; ++x)
for(int y = 0; y < MAP_TILE_HEIGHT; ++y)
background[x][y] = new sf::RenderTexture(TILE_WIDTH, TILE_HEIGHT);
background[x][y]->setView(sf::FloatRect(x * TILE_WIDTH,
y * TILE_HEIGHT,
for(sf::Sprite *sprite : sprites)
const sf::Vector2f &position = sprite->getPosition();
background[position->x / TILE_WIDTH][position->y / TILE_HEIGHT]->draw(*sprite);
sf::RenderWindow *window; // initialized somewhere else
const sf::Vector2f topLeft = window->mapPixelToCoords(sf::Vector2f(0,0));
const sf::Vector2f bottomRight = window->mapPixelToCoords(window->getView().getSize());
for(int x = topLeft.x / TILE_WIDTH; x <= bottomRight.x / TILE_WIDTH; ++x)
for(int y = topLeft.y / TILE_HEIGHT; y <= bottomRight.y / TILE_HEIGHT; ++y)
If your sprites are sized right and aligned well, this will work nicely. If your sprites can be across tile boundaries then you have to draw the sprites on all the tiles they are positioned over.
This works until you fill GPU memory with all your render textures then you have to move on to method 2 which is some type of streaming system. Tiles close to the view are loaded into an
sf::Texture via the
sf::Texture::loadFromImage() function while tiles farther away from the view are copied into an
sf::Image for storing in system memory via the
sf::Texture::copyToImage() function. This might cause some performance slowdown due to the copying back and forth from gpu memory but it is the only alternative to reducing the resolution of your images so they fit in GPU memory.