1
Graphics / Re: Sfml drawing faster algorithm slower
« on: December 18, 2019, 09:37:45 pm »
Well maybe I missunderstand something in vectors because I'm new in c++ but I got perfromance that I needed.
About 2 dimension VectorArray.
I need VectorArray of points (All of them make big square). I have to color every pixel.For example With RectangleShape[][] I could do something like that.
In vectors I have to add another field to iterate and for square of pixels it looks like that
To make it easier for 1D VertexArray its much harder to make conditions of coloring than RectangleShape 2D array. Thats why I'm asking about it.
About 2 dimension VectorArray.
I need VectorArray of points (All of them make big square). I have to color every pixel.For example With RectangleShape[][] I could do something like that.
for(int i=0; i<1000; i++){
for(int j=0; j<1000; j++){
if(condition)
shape[i-1][j+1].setFillColor = Color::Red;
}
}
for(int j=0; j<1000; j++){
if(condition)
shape[i-1][j+1].setFillColor = Color::Red;
}
}
In vectors I have to add another field to iterate and for square of pixels it looks like that
int pom = 0;
int j = 0;
int i = 0;
for (; i < 1000000; i = i + 1000) {
for (j = 0; j < 1000; j++) {
if(condition)
vertex[pom-999].color = Color::Red;
pom++;
int j = 0;
int i = 0;
for (; i < 1000000; i = i + 1000) {
for (j = 0; j < 1000; j++) {
if(condition)
vertex[pom-999].color = Color::Red;
pom++;
To make it easier for 1D VertexArray its much harder to make conditions of coloring than RectangleShape 2D array. Thats why I'm asking about it.