1 /* $Id: glutskel.c,v 1.2 2004/04/22 00:47:28 brianp Exp $ */
4 * A skeleton/template GLUT program
6 * Written by Brian Paul and in the public domain.
11 * $Log: glutskel.c,v $
12 * Revision 1.2 2004/04/22 00:47:28 brianp
15 * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
18 * Revision 1.2 1998/11/07 14:20:14 brianp
19 * added simple rotation, animation of cube
21 * Revision 1.1 1998/11/07 14:14:37 brianp
33 static GLfloat Xrot
= 0, Yrot
= 0, Zrot
= 0;
34 static GLboolean Anim
= GL_FALSE
;
50 glClear(GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
53 glRotatef(Xrot
, 1, 0, 0);
54 glRotatef(Yrot
, 0, 1, 0);
55 glRotatef(Zrot
, 0, 0, 1);
66 Reshape(int width
, int height
)
68 glViewport(0, 0, width
, height
);
69 glMatrixMode(GL_PROJECTION
);
71 glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
72 glMatrixMode(GL_MODELVIEW
);
74 glTranslatef(0.0, 0.0, -15.0);
79 Key(unsigned char key
, int x
, int y
)
81 const GLfloat step
= 3.0;
107 SpecialKey(int key
, int x
, int y
)
109 const GLfloat step
= 3.0;
133 /* setup lighting, etc */
134 glEnable(GL_DEPTH_TEST
);
135 glEnable(GL_LIGHTING
);
141 main(int argc
, char *argv
[])
143 glutInit(&argc
, argv
);
144 glutInitWindowPosition(0, 0);
145 glutInitWindowSize(400, 400);
146 glutInitDisplayMode(GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
147 glutCreateWindow(argv
[0]);
148 glutReshapeFunc(Reshape
);
149 glutKeyboardFunc(Key
);
150 glutSpecialFunc(SpecialKey
);
151 glutDisplayFunc(Draw
);