int main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (300, 300); glutCreateWindow ("window for torus"); myinit (); glutReshapeFunc (myReshape); glutDisplayFunc(display); glutKeyboardFunc(key); while(true) { glutMainLoopEvent(); roangles += 3.0f; glutPostRedisplay(); } // glutMainLoop(); return 0; /* ANSI C requires main to return int. */}
int main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize (300, 300); glutCreateWindow ("window for torus"); myinit (); glutReshapeFunc (myReshape); glutDisplayFunc(display); glutKeyboardFunc(key); while(true) { glutMainLoopEvent(); roangles += 3.0f; glutPostRedisplay(); } // glutMainLoop(); return 0; /* ANSI C requires main to return int. */}
完全的程式碼,看附件吧。。。還有一定要用freeglut,才是支援這個glutMainLoopEvent()的