2 * A skeleton/template GLUT program
4 * Written by Brian Paul and in the public domain.
14 static GLfloat Xrot
= 0, Yrot
= 0, Zrot
= 0;
15 static GLboolean Anim
= GL_FALSE
;
31 glClear(GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
34 glRotatef(Xrot
, 1, 0, 0);
35 glRotatef(Yrot
, 0, 1, 0);
36 glRotatef(Zrot
, 0, 0, 1);
47 Reshape(int width
, int height
)
49 glViewport(0, 0, width
, height
);
50 glMatrixMode(GL_PROJECTION
);
52 glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
53 glMatrixMode(GL_MODELVIEW
);
55 glTranslatef(0.0, 0.0, -15.0);
60 Key(unsigned char key
, int x
, int y
)
62 const GLfloat step
= 3.0;
80 glutDestroyWindow(Win
);
89 SpecialKey(int key
, int x
, int y
)
91 const GLfloat step
= 3.0;
115 /* setup lighting, etc */
116 glEnable(GL_DEPTH_TEST
);
117 glEnable(GL_LIGHTING
);
123 main(int argc
, char *argv
[])
125 glutInit(&argc
, argv
);
126 glutInitWindowPosition(0, 0);
127 glutInitWindowSize(400, 400);
128 glutInitDisplayMode(GLUT_RGB
| GLUT_DOUBLE
| GLUT_DEPTH
);
129 Win
= glutCreateWindow(argv
[0]);
130 glutReshapeFunc(Reshape
);
131 glutKeyboardFunc(Key
);
132 glutSpecialFunc(SpecialKey
);
133 glutDisplayFunc(Draw
);