PDA

View Full Version : Why my animation is flickering?



Asura
03-31-2006, 11:24 AM
Hi all:
I configured my opengl like the following:

void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0); // Set display-window color to white.
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); // display objects as wireframe

glutIdleFunc(aniDisplay);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glMatrixMode(GL_PROJECTION);
glFrustum(-100, 100, -100, 100, 100, 1000);
glMatrixMode(GL_MODELVIEW);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 1.0, 0.0);
glPushMatrix();
.............// code for drawing pictures
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void aniDisplay(){
EulerStep(0.001); glutPostRedisplay();
}This is my configurations. I used double buffer but it is still flickering. Does anybody know how to fix the problem please?
Thanks a lot!!!

jide
03-31-2006, 12:30 PM
Don't do it like that:

call IdleFunc and InitDisplayMode directly in main. Call PostRedisplay after SwapBuffers. But as I don't really know what EulerStep is supposed to do, this might not be suffisant thougth.

Asura
04-01-2006, 10:13 AM
Thanks I have solved the problem!!