And? What's wrong with OpenGL being called by SFML?
Yea,
additional OpenGL calls. It may doesn't affect the performance if i do it in initialization, it may only take few ms but as we know we should minimize any OpenGL calls in the game loop.
I don't understand why you're so worried about performances. Creation of the texture atlas will happen once, preferably during init/loading, so the time it takes should never be an issue (as long as you don't do something wrong that makes it take several seconds). Just use an implementation that you like, and/or that is simple enough.
Oops, my bad not to explain whole things in the first post. The TextureAtlas class can be used any purpose, indeed it obviously to compose a sets of Texture (or Image?) to the single Texture
but it may ideal to other purpose, such as Sprite batching.
When the very first render is called, the sprite batch gathers all information about sprite that pushed into it as well as push the sprite texture into the texture atlas.The texture is cached inside the atlas, so whenever any sprite is added with same texture, it shouldn't add it again, the number of texture inside texture atlas remain the same.
As the game progress, a new sprite with unique texture may appear and pushed into sprite batch, in other words the texture atlas can be used to construct dynamic sprite batching and the newly added sprite texture need to updated into atlas.
Though this is one of its example (but yea, I intended to use this for sprite batching), there maybe other applicable implementation beyond my thinking which probably i need on later.
Therefore, I need to determine which is the best approach to achieve this
Anyway, thanks for your reply