From: Brian Paul Date: Fri, 28 Aug 2009 14:55:20 +0000 (-0600) Subject: progs/util: minor updates to glutskel.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dd6fa12e12a0588026da4d7f4d11ba6056fc5c2;p=mesa.git progs/util: minor updates to glutskel.c --- diff --git a/progs/util/glutskel.c b/progs/util/glutskel.c index 273ed9a2f5a..8499e12a9de 100644 --- a/progs/util/glutskel.c +++ b/progs/util/glutskel.c @@ -11,6 +11,7 @@ #include static int Win; +static int WinWidth = 400, WinHeight = 400; static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; static GLboolean Anim = GL_FALSE; @@ -46,6 +47,8 @@ Draw(void) static void Reshape(int width, int height) { + WinWidth = width; + WinHeight = height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -63,23 +66,23 @@ Key(unsigned char key, int x, int y) (void) x; (void) y; switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'z': + Zrot -= step; + break; + case 'Z': + Zrot += step; + break; + case 27: + glutDestroyWindow(Win); + exit(0); + break; } glutPostRedisplay(); } @@ -92,18 +95,18 @@ SpecialKey(int key, int x, int y) (void) x; (void) y; switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; + case GLUT_KEY_UP: + Xrot -= step; + break; + case GLUT_KEY_DOWN: + Xrot += step; + break; + case GLUT_KEY_LEFT: + Yrot -= step; + break; + case GLUT_KEY_RIGHT: + Yrot += step; + break; } glutPostRedisplay(); } @@ -123,8 +126,7 @@ int main(int argc, char *argv[]) { glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); + glutInitWindowSize(WinWidth, WinHeight); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); Win = glutCreateWindow(argv[0]); glutReshapeFunc(Reshape);