SFML: Generate a background image
- by BlackMamba
I want to generate a background, which is used in the game, on every instance of the game based on certain conditions. To do so, I'm using a sf::RenderTexture and a sf::Texture like this:
sf::RenderTexture image;
std::vector<sf::Texture> textures;
sf::Texture texture;
// instantiating the vector of textures and the image not shown here
for (int i = 0; i < certainSize; ++i)
{
if(certainContition)
{
texture.setTexture("file");
texture.setPosition(pos1, pos2);
} else
{
...
}
image.draw(texture);
}
The point here is that I draw single textures on a sf::RenderTexture, but because textures always are on the graphic cards memory, I can't exceed a certain map size which I have to.
I also considered using an sf::Image, but I can't find a way to draw an image (i.e. a texture) to it.
The third way I found was using an sf::VertexArray, but this seems to be a bit too low-level for my rather simple purposes.
So is there a common way to dynamically generate a background image based on other existing images?