Getting 2 lines when I draw 1


#1

Using Code::Blocks 17.12 on Windows 10 with SDL 2.0.9.

I am drawing various lines as part of my program and I noticed that in one instance I am seeing 2 lines when I only want to draw 1. Here is the code snippet:

double angle = 0.0;
double x = 200.0;
double angle2 = 0.0;
double y = 200.0;

while(true)
{
  angle -= 0.5 * switcher; // switcher value may be 1 or -1
  SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
  SDL_RenderClear(renderer);
  SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
  SDL_RenderDrawLine(renderer, x + 100 * cos(angle),
                               y - 100 * sin(angle),
                               x - 100 * cos(angle),
                               y + 100 * sin(angle));
  SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
  SDL_RenderDrawLine(renderer, x + 100 * cos(angle2),
                               y - 100 * sin(angle2),
                               x - 100 * cos(angle2),
                               y + 100 * sin(angle2));
  SDL_RenderPresent(renderer);
}

The static line (angle2) seems to have no issues, nor have any other lines I tested. I have tried changing the colors and the number 100 to see if that matters, but it does not. Even the order doesn’t affect anything. As an additional test, I tried making some of the angles static, but as long as 1 or more were changing, I got the double lines.

Edit: The double line does not show up on screenshots, which is strange since I have been able to capture other irregularities in the past. See the screen shot below. The top line usually has another line tilted slightly down at 10-20 degrees.

nosplit

Any ideas?