I try to create Texture atlas on the fly from a sets of image. Initially, I create my own class, let's say TextureAtlas, it contains a sf::Texture. Later on, the image will be updated to this sf::Texture
in the construction phase of TextureAtlas , let say, the first image is being uploaded to texture data:
sf::Texture texture;
if (!texture.loadFromFile("something.png")) // let's assume the image size is 80x80
{
// error...
}
Now, when a new image is need to be uploaded into the atlas, the first thing that comes from my mind is to resize the texture then update the texture with the new image.
For example, the new image contains 100x100 image, since the last image size is 80x80 and i want to advance horizontally (X axis) so the next image will be placed on x:80 y:0 while the image need to resize to 180x100
It appears that if I call sf::Texture::update(), the new image *seems* uploaded but the sf::Texture size will remain the same. in above case, the sf::Texture remain 80x80, while the new image uploaded on x:80, that means the new image is not included and nothing changed to the sf:Texture!
So... how do I achieve this with SFML?