static frustumMode_t frustumMode = LETTERBOX; static GLdouble aspectRatio; // of the Frustum static GLint windowWidth; static GLint windowHeight; // and saved values of the same static GLint windowWidth_old; static GLint windowHeight_old; // Sets the three global variables for the windowWidth, windowHeight, and // aspectRatio. void setWindow(GLint ww, GLint wh) { windowWidth=ww; windowHeight=wh; aspectRatio=((GLdouble)ww)/((GLdouble) wh); twMessage(TW_WINDOW,"window = (%d,%d), aspect ratio = %f\n", ww,wh,aspectRatio); } // Reshape Callback void twReshapeFunction(int w,int h) { setWindow(w,h); } void twInitWindowSize(GLint xsize, GLint ysize) { glutInitWindowSize(xsize,ysize); windowWidth=xsize; windowHeight=ysize; } void twFullScreen() { twMessage(TW_WINDOW,"switch to full screen, saving %d x %d", windowWidth,windowHeight); windowWidth_old = windowWidth; windowHeight_old = windowHeight; glutFullScreen(); } void twWindow() { twMessage(TW_WINDOW,"back to %d x %d window\n", windowWidth_old,windowHeight_old); glutReshapeWindow(windowWidth_old,windowHeight_old); glutPositionWindow(0,0); }