Hey Folks,
So I have around 45 png files that I need to load in when the game first starts and I want to store in a vector.
During the initial process of the game I load in the textures using the below. I only call this once during the init phase of the game.
sf::Time time = gameClock.getElapsedTime();
sf::Texture texture;
vector<sf::Texture> regionTextureList;
cout << "Start time SFML2.2:- " << time.asMilliseconds() << endl;
for (int i = 0; i < regionListPtr->size(); i++)
{
texture.loadFromFile(regionListPtr->at(i).getRegionImageFileName());
texture.setSmooth(true);
regionTextureList.push_back(texture);
}
Strangely the loadFromFile is not the slowest part. I've found that the push_back onto the vector as the slowest part.
The PNG files are 5760 x 3240 so obviously quite large. However the content isn't large in size 99kb. See below an example.
So when I say slow, I meaning minutes. My graphics card isn't the greatest AM Radeon HD8490 4818MB (when I going into advanced setting of my screen resolution page in windows7). My PC has tons of RAM though 32GB.
Whilst I can obviously scale down the png, load them in and scale up, I do find the png a bit sharper/nicer (especially scaling up) when I load them as 5760 X 3240, as opposed to loading them in as 1920 x 1080 and scaling up by 3.
I am wondering if there is a more efficient way to store very large textures? I thought a vector was the way to go in c++ but wondering if there is a better method? Or am I just limited by my rubbish graphics card?