http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / hacks / glx / extrusion-helix2.c
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  */
15
16 /* required include files */
17 #ifdef HAVE_CONFIG_H
18 #include <config.h>
19 #endif
20
21 #include <GL/gl.h>
22 /*#include <GL/glut.h>*/
23 #ifdef HAVE_GLE3
24 #include <GL/gle.h>
25 #else
26 #include <GL/tube.h>
27 #endif
28
29 /* controls shape of object */
30 extern float lastx;
31 extern float lasty;
32
33 void InitStuff_helix2 (void) 
34 {
35 }
36
37 /* draw the helix shape */
38 void DrawStuff_helix2 (void) 
39 {
40    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
41    glColor3f (0.6, 0.3, 0.8);
42
43    /* set up some matrices so that the object spins with the mouse */
44    glPushMatrix ();
45 /* glTranslatef (0.0, 0.0, -80.0);   */
46 /* glRotatef (220.0, 0.0, 1.0, 0.0); */
47 /* glRotatef (65.0, 1.0, 0.0, 0.0);  */
48
49    /* Phew. FINALLY, Draw the helix  -- */
50    gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP);
51    gleHelicoid (0.01*lastx, 
52                 6.0, (0.01*lasty - 2.0), 
53                -3.0, 4.0, 0x0, 0x0, 0.0, 1080.0);
54
55    glPopMatrix ();
56
57 }
58 /* ------------------------- end of file ----------------- */