I’m trying to make an application to do path simulation and show the moving point animation. Basically, I have a set of ordered points that are pre-calculated and I want to show this path to a user. Currently My code is like following
int total = points.size();
int current = 0;
for(int current = 0;current<total;current++)
glColor3f(1.0f, 0.0f, 0.0f);
for(int i = 0; i<current; i++)
glutPostRedisplay(); //repaint the display
As you can see, it repaints for every new point and the user can see a moving point. However, it works fine for small number of points. If I have a large number of points (eg 10 million), it becomes very slow at the end.
If I dont repaint previous points, everything disappears. Is there anyway to persist what I have drawn on the screen?