Q: SDL while running loop glitch. Why is the if statement making the SDL window not render properly If the number inside the if statement is changed to anything less than 40 the program will start rendering the SDL window correctly does anyone know why is this happening?? thanks in advances.
while(this->running) {
    SDL_PollEvent(&event);
    if(event.type == SDL_QUIT) {this->running = false;}

    currentTime = SDL_GetTicks();

    //changing the 40 on the if statement below
    //to any other number less than 30 
    //will make the program run correctly. I'm not sure why 
    //this is happening. help!!!
    if(currentTime > lastTime + 40) {
        SDL_UpdateTexture(
            this->texture,
            NULL,
            this->pixels,
            this->WIDTH * sizeof(Uint32)
        );

        for(int i = 0;i < HEIGHT;i++){
            for(int j = 0;j < WIDTH;j++){
                this->pixels[i*WIDTH + j] = DSDL_MapTanhToRGB(fmt,1000000/(pow(i-HEIGHT/2,2) + pow(j-WIDTH/2,2)+100*(int)loopCount+1));
            }
        }

        SDL_RenderClear(renderer);
        SDL_RenderCopy(renderer, texture, NULL, NULL);
        SDL_RenderPresent(renderer);

        //printf("Loop #: %d\n",loopCount);
    }

    lastTime = currentTime;
    loopCount++;
}

Ultimately what I'm trying to do with the if statement is to lower the frames per second to use cpu resources somewhere else.
