# Why (SDL) animated filled-circle leaves trail of movement?

I'm trying to achieve proper animation using SDL. Used flags are SDL_HWSURFACE and SDL_DOUBLEBUF.

That what I'm getting is technically smooth (I think), but I can figure out what should I do to remove that trail? My animation is time-based (I'm calculating displacement with delta time).

my (every-frame) drawing function is like:

for(int x = 0; x < screen->w; ++x)
for(int y = 0; y < screen->h; ++y)
draw_pixel(screen, x, y, 136, 136, 136);


and ball:

filledCircleColor(screen, ball.x, ball.y, 17, 0x000000ff);


and finally:

SDL_Flip(screen);


main loop is:

for(;;) {
curr_ts = stopwatch_seconds_elapsed(sw);
d_time = curr_ts - prev_ts;
prev_ts = curr_ts;
cpSpaceStep(space, d_time);
draw_scene(screen);
}

• You may need a higher speed display matrix :p (or more durable eyes) – user1306322 Mar 18 '13 at 12:03
• I think I understand what you are getting at but if you could be clearer with what problem you are trying to solve, specifically what you don't like about the animation that would help. You'll want to update the title and the body of the question accordingly. – SpartanDonut Mar 18 '13 at 12:09
• how are you clearing? – t123 Mar 18 '13 at 13:16
• Try stepping through the render loop one frame at a time to verify you are actually getting the trails, and it isn't simply an anomaly associated with human eyeballs. If you are still getting the trails, then it is likely because the buffer isn't being properly cleared after each frame. – Evan Mar 18 '13 at 13:49
• Evan: Animation snapshot doesn't contain trail. – jacekmigacz Mar 18 '13 at 14:22