diff options
author | Simon Rettberg | 2018-10-16 10:08:48 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-10-16 10:08:48 +0200 |
commit | d3a98cf6cbc3bd0b9efc570f58e8812c03931c18 (patch) | |
tree | cbddf8e50f35a9c6e878a5bfe3c6d625d99e12ba /hacks/glx/extrusion-helix4.c | |
download | xscreensaver-d3a98cf6cbc3bd0b9efc570f58e8812c03931c18.tar.gz xscreensaver-d3a98cf6cbc3bd0b9efc570f58e8812c03931c18.tar.xz xscreensaver-d3a98cf6cbc3bd0b9efc570f58e8812c03931c18.zip |
Original 5.40
Diffstat (limited to 'hacks/glx/extrusion-helix4.c')
-rw-r--r-- | hacks/glx/extrusion-helix4.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/hacks/glx/extrusion-helix4.c b/hacks/glx/extrusion-helix4.c new file mode 100644 index 0000000..fbf1602 --- /dev/null +++ b/hacks/glx/extrusion-helix4.c @@ -0,0 +1,63 @@ + +/* + * helicoid (gernalized torus) demo + * + * FUNCTION: + * This code provides a very simple example of the helicoid primitive. + * Most of this code is required to set up OpenGL and GLUT, and very + * very little to set up the helix drawer. Don't blink! + * + * =======> MOUSE HOOKED UP TO AFFINE < ======== + * + * HISTORY: + * Written by Linas Vepstas, March 1995 + */ + +#include "extrusion.h" + +/* controls shape of object */ +extern float lastx; +extern float lasty; + +void InitStuff_helix4 (void) +{ +} + +/* draw the helix shape */ +void DrawStuff_helix4 (void) +{ + double affine[2][3]; + double delta_affine[2][3]; + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glColor3f (0.7, 0.5, 0.3); + + /* set up some matrices so that the object spins with the mouse */ + glPushMatrix (); +/* glTranslatef (0.0, 0.0, -80.0); */ +/* glRotatef (220.0, 0.0, 1.0, 0.0); */ +/* glRotatef (65.0, 1.0, 0.0, 0.0); */ + + /* Phew. FINALLY, Draw the helix -- */ + affine [0][0] = 1.0/ (0.01*lastx); + affine [1][0] = 0.0; + affine [0][1] = 0.0; + affine [1][1] = 0.01*lastx; + affine [0][2] = 0.0; + affine [1][2] = 0.0; + + delta_affine [0][0] = 0.0; + delta_affine [1][0] = 0.03*lasty; + delta_affine [0][1] = -0.03*lasty; + delta_affine [1][1] = 0.0; + delta_affine [0][2] = 0.0; + delta_affine [1][2] = 0.0; + + gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP); + gleHelicoid (1.0, 7.0, -1.0, + -4.0, 6.0, affine, delta_affine, 0.0, 980.0); + + glPopMatrix (); + +} +/* ------------------------- end of file ----------------- */ |