vendredi 6 avril 2018

differences between drawing a line or many points

i have a small issue that i don't understand. I'm using C++ with SDL2 engine. I don't understand why drawing a line with width:10000 is faster than make a loop of 10000 iterations and draw all the points that make up the line.

Drawing a line:

SDL_RenderDrawLine(Renderer, 0, 100, 10000, 100);

Drawing 10000 points:

for(unsigned k=0; k<10000; k++) {
    SDL_RenderDrawPoint(Renderer, 0+k, 100);
}

Why drawing all the points kills the program performance? I think the draw_line function does the same...

I'd like to know why this because i'm trying to create some functions about shaders..

Aucun commentaire:

Enregistrer un commentaire