# HG changeset patch # User nuclear@neutrino-win7.lan # Date 1327712187 -7200 # Node ID d2e283764fcac910d8713c924bef1e47262a5a92 # Parent 5562a637e5aaa22280b10e7e880fd98494795225 fixed fullscreen separate idle func so it works on windows too diff -r 5562a637e5aa -r d2e283764fca src/main.c --- a/src/main.c Mon Jan 23 08:51:59 2012 +0200 +++ b/src/main.c Sat Jan 28 02:56:27 2012 +0200 @@ -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;