# HG changeset patch # User John Tsiombikas # Date 1346724673 -10800 # Node ID 1a3799ff443a0ab731d59c48c95d997f4fd8c37c # Parent d0896caa3e5b3ff55c63875f56418e05eee7c556# Parent d2e283764fcac910d8713c924bef1e47262a5a92 merged fullscreen and minor edit diff -r d0896caa3e5b -r 1a3799ff443a src/main.c --- a/src/main.c Tue Sep 04 05:10:47 2012 +0300 +++ b/src/main.c Tue Sep 04 05:11:13 2012 +0300 @@ -16,6 +16,7 @@ void proj_matrix(float eye); void view_matrix(float eye); +void idle(void); void reshape(int x, int y); void keyb(unsigned char key, int x, int y); void keyb_up(unsigned char key, int x, int y); @@ -63,7 +64,7 @@ glutSpaceballRotateFunc(sball_rotate); glutSpaceballButtonFunc(sball_button); if(auto_rot) { - glutIdleFunc(glutPostRedisplay); + glutIdleFunc(idle); } glewInit(); @@ -172,6 +173,11 @@ glRotatef(cam_theta, 0, 1, 0); } +void idle(void) +{ + glutPostRedisplay(); +} + void reshape(int x, int y) { glViewport(0, 0, x, y); @@ -235,7 +241,7 @@ case ' ': auto_rot = !auto_rot; if(auto_rot) { - glutIdleFunc(glutPostRedisplay); + glutIdleFunc(idle); } else { glutIdleFunc(0); } @@ -245,10 +251,16 @@ case 'f': { static int fullscr; + static int orig_xsz, orig_ysz; if(++fullscr & 1) { + int vp[4]; + glGetIntegerv(GL_VIEWPORT, vp); + orig_xsz = vp[2]; + orig_ysz = vp[3]; glutFullScreen(); } else { - glutPositionWindow(20, 20); + glutReshapeWindow(orig_xsz, orig_ysz); + glutPositionWindow(20, 40); } } break;