You need to move all the SDL functions out of the compound for loop.
for
{
for
{
pixels[y*width+x] = argb;}}
//Update allUpdating pixelthem valuesall at once should be fine
//ThenNothing else can happen while this is running
}
}
//Update entire array at once, then...
SDL_UpdateTexture(texture, NULL, pixels, width * 4); //Copy entire array only once
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);