/******************************/ /* Rotating cube */ /* (C) Bedrich Benes 2004 */ /* bbenes ~at~ purdue.edu */ /******************************/ #include #include #include void Reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1, 1, -1, 1, -10, 10); } void Idle(void) { static float r=1; register i,j; glClear(GL_COLOR_BUFFER_BIT); glColor3f(1,1,0); glutWireTeapot(0.6); glRotatef(3,1,1,1); for (j=0;j<100;j++) for (i=0;i<100000;i++); // glFlush(); glutSwapBuffers(); } void Display(void) { //intentionally empty - everything is displayed in the Idle() routine //this procedure is required anyway } void Kbd(unsigned char a, int x, int y) { exit(0); } unsigned int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutCreateWindow("Rotating teapot"); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutIdleFunc(Idle); glutKeyboardFunc(Kbd); glutMainLoop(); return 0; }