1
2 /*
3 * helicoid (gernalized torus) demo
4 *
5 * FUNCTION:
6 * This code provides a very simple example of the helicoid primitive.
7 * Most of this code is required to set up OpenGL and GLUT, and very
8 * very little to set up the helix drawer. Don't blink!
9 *
10 * =======> MOUSE HOOKED UP TO RADIUS, DELTA-RADIUS < ========
11 *
12 * HISTORY:
13 * Written by Linas Vepstas, March 1995
14 * Copyright (c) 1995 Linas Vepstas <linas@linas.org>
15 */
16
17 /* required include files */
18 #include <GL/gl.h>
19 #include <GL/glut.h>
20 #include <GL/gle.h>
21 #include "main.h"
22
InitStuff(void)23 void InitStuff (void)
24 {
25 lastx = 121.0;
26 lasty = 121.0;
27 }
28
29 /* draw the helix shape */
DrawStuff(void)30 void DrawStuff (void)
31 {
32 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
33 glColor3f (0.6, 0.3, 0.8);
34
35 /* set up some matrices so that the object spins with the mouse */
36 glPushMatrix ();
37 glTranslatef (0.0, 0.0, -80.0);
38 glRotatef (220.0, 0.0, 1.0, 0.0);
39 glRotatef (65.0, 1.0, 0.0, 0.0);
40
41 /* Phew. FINALLY, Draw the helix -- */
42 gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP);
43 gleHelicoid (0.01*lastx,
44 6.0, (0.01*lasty - 2.0),
45 -3.0, 4.0, 0x0, 0x0, 0.0, 1080.0);
46
47 glPopMatrix ();
48
49 glutSwapBuffers ();
50 }
51 /* ------------------------- end of file ----------------- */
52