8 * -- created by Linas Vepstas October 1991
9 * -- heavily modified to draw more texas shapes, Feb 1993, Linas
10 * -- converted to use GLUT -- December 1995, Linas
14 /* required include files */
22 /*#include <GL/glut.h>*/
30 #define NULL ((void *) 0x0)
33 /* =========================================================== */
36 #define CONTOUR(x,y) { \
37 double ax, ay, alen; \
38 contour[i][0] = SCALE * (x); \
39 contour[i][1] = SCALE * (y); \
41 ax = contour[i][0] - contour[i-1][0]; \
42 ay = contour[i][1] - contour[i-1][1]; \
43 alen = 1.0 / sqrt (ax*ax + ay*ay); \
44 ax *= alen; ay *= alen; \
45 norms [i-1][0] = ay; \
46 norms [i-1][1] = -ax; \
53 static double contour [NUM_PTS][2];
54 static double norms [NUM_PTS][2];
56 static void init_contour (void)
60 /* outline of extrusion */
86 CONTOUR (1.0, 1.0); /* repeat so that last normal is computed */
89 /* =========================================================== */
91 /* controls shape of object */
95 void InitStuff_screw (void)
99 /* configure the pipeline */
101 style |= TUBE_CONTOUR_CLOSED;
102 style |= TUBE_NORM_FACET;
103 style |= TUBE_JN_ANGLE;
104 gleSetJoinStyle (style);
109 /* =========================================================== */
111 void DrawStuff_screw (void) {
113 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
114 glColor3f (0.5, 0.6, 0.6);
116 /* set up some matrices so that the object spins with the mouse */
118 /* glTranslatef (0.0, 0.0, -80.0); */
119 /* glRotatef (130.0, 0.0, 1.0, 0.0); */
120 /* glRotatef (65.0, 1.0, 0.0, 0.0); */
122 /* draw the brand and the handle */
123 gleScrew (20, contour, norms,
124 NULL, -6.0, 9.0, lasty);
129 /* ===================== END OF FILE ================== */