1
Graphics / Re: Drawing Hextiles is slow
« on: March 07, 2016, 10:42:30 pm »
Thanks for your comments guys. I switched from debug-mode and it went down from 16 minutes to 2 minutes! Huge improvement but still long time for such a small map. I identified the delay to be located in drawing for loop for vector columns
for (int c = 0; c < test.ReturnMap()[0].size(); c++)
{
texture.draw(test.ReturnHex(r, c));
}
For some reason the test.ReturnMap()[0].size() call makes the whole loop sluggish.
When switching to a number (100) the time to draw 100 * 100 hexes went down to 1.9 seconds.
I still think it's slow if you go higher like 500 * 500 hexes, at 1000 * 1000 hexes it actually crashes and throws an exception.
texture.setRepeated( true ); improved the speed by 0.5 sec for 100*100 map.
If I use vertexArray do I get same functionality as with sf::ConvexShape?
for (int c = 0; c < test.ReturnMap()[0].size(); c++)
{
texture.draw(test.ReturnHex(r, c));
}
For some reason the test.ReturnMap()[0].size() call makes the whole loop sluggish.
When switching to a number (100) the time to draw 100 * 100 hexes went down to 1.9 seconds.
I still think it's slow if you go higher like 500 * 500 hexes, at 1000 * 1000 hexes it actually crashes and throws an exception.
texture.setRepeated( true ); improved the speed by 0.5 sec for 100*100 map.
If I use vertexArray do I get same functionality as with sf::ConvexShape?