summaryrefslogtreecommitdiffstats
path: root/progs/util
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-08-28 08:55:20 -0600
committerBrian Paul <[email protected]>2009-08-30 09:10:36 -0600
commit7dd6fa12e12a0588026da4d7f4d11ba6056fc5c2 (patch)
tree537f834065ba4f37bb794b617645e564e4e57708 /progs/util
parenta068e098e275fc5d2aba309165263834f429143e (diff)
progs/util: minor updates to glutskel.c
Diffstat (limited to 'progs/util')
-rw-r--r--progs/util/glutskel.c64
1 files changed, 33 insertions, 31 deletions
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 <GL/glut.h>
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);