1
Graphics / How to optimize multiple draws
« on: May 21, 2021, 05:05:12 am »
Hi,
I'm working on a cellular automaton and I have to print a grid of cells with sfml.
It's working fine when cells are about less than 600, but when the grid gets bigger, the 600+ draw function calls really slow down the software. Is there any way to make it faster?
This is the problematic part of the code: the vector can contain up to 518400 elements, and with 600 it already starts to take some time to draw all.
I'm working on a cellular automaton and I have to print a grid of cells with sfml.
It's working fine when cells are about less than 600, but when the grid gets bigger, the 600+ draw function calls really slow down the software. Is there any way to make it faster?
This is the problematic part of the code: the vector can contain up to 518400 elements, and with 600 it already starts to take some time to draw all.
Quote
automatonWindow.clear()
for(Person currentPerson : *evolutionIterator){
//Set cell color according to it's status
personCell.setPosition(x, y);
automatonWindow.draw(personCell);
}
automatonWindow.display()