void updateGL() { GLfloat aspectRatio = (GLfloat)windowWidth / windowHeight; glViewport(0, 0, windowWidth, windowHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fov, aspectRatio, zNear, zFar); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); trackball.rotateView(); // render // renderScene(); // swap render and screen buffer // glutSwapBuffers(); }