void reshape(int w, int h) { glViewport(0, 0, w, h); myDisplay(); } ... glutDisplayFunc(myDisplay); glutReshapeFunc(reshape);