Reputation: 33
void display(void)
{
char text1[10],text2[10];
int i;
glPointSize(2.0);
glClear(GL_COLOR_BUFFER_BIT);
circle_draw(x1center,y1center,radius1);
y1center-=5;
while(y1center>=100)
{
glutPostRedisplay();
y1center-=5;
}
glFlush();
}
I want to move the circle along the vertical axis. But while using the glutPostRedisplay() function I can only see the initial and final positions of the circle. The transition is too fast to see.
Upvotes: 0
Views: 3265
Reputation: 490148
void display(void)
{
char text1[10],text2[10];
int i;
glPointSize(2.0);
glClear(GL_COLOR_BUFFER_BIT);
circle_draw(x1center,y1center,radius1);
glFlush();
}
void update(int) {
if (y1center > 100) {
y1center -= 5;
glutPostRedisplay();
glutTimerFunc(100, update, 0);
}
}
int main() {
// ...
glutTimerFunc(100, update, 0);
// ...
}
Upvotes: 2