hi..

int w=500, h=500;
int count=0, flip=0;


void myReshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(flip==1)
{
glOrtho(-1, 1, 1, 0, -10, 10);
flip=0;
}
else
{
glOrtho(-1, 1, -1, 0, -10, 10);
}
glScalef(1, 1, 0);
glTranslatef(0, 0, 0);
}


void DrawTriangle(void)
{




glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(1.0,0.0,0.0); glVertex3f(1.0, 0.0, 0.0);
glColor3f(0.0,1.0,0.0); glVertex3f(0.0, 1.0, 0.0);
glColor3f(0.0,0.0,1.0); glVertex3f(-1.0, 0.0, 0.0);
glEnd();
glFlush ();
sleep(1);
count=count+1;
if(count>=5)
{
flip=1;
glutReshapeFunc (myReshape);
count=0;
}




printf("count %d flip %d\n",count,flip);
}






void display()
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}






int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (500, 500);
glutCreateWindow (argv[0]);
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutIdleFunc(DrawTringle);
glutMainLoop();
return 0;
}
I am beginner to opegl, in this code i want to reverse the triangle without changing the code for Triangle draw. I want to flip the displayed triangle with change in glutReshapeFunc, where it will call glOrtho.
but when i am calling glutReshapeFunc in DrawTriangle, its not executing the glutReshapeFunc, so the flip is not happening.
if there is any other method to do it plz tell me.
Thanks