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 */
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 double contour [NUM_PTS][2];
54 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 /* =========================================================== */
97 void InitStuff_screw (void)
101 /* configure the pipeline */
103 style |= TUBE_CONTOUR_CLOSED;
104 style |= TUBE_NORM_FACET;
105 style |= TUBE_JN_ANGLE;
106 gleSetJoinStyle (style);
111 /* =========================================================== */
113 void DrawStuff_screw (void) {
115 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
116 glColor3f (0.5, 0.6, 0.6);
118 /* set up some matrices so that the object spins with the mouse */
120 glTranslatef (0.0, 0.0, -80.0);
121 glRotatef(rot_x, 1, 0, 0);
122 glRotatef(rot_y, 0, 1, 0);
123 glRotatef(rot_z, 0, 0, 1);
124 /* glRotatef (130.0, 0.0, 1.0, 0.0); */
125 /* glRotatef (65.0, 1.0, 0.0, 0.0); */
127 /* draw the brand and the handle */
128 gleScrew (20, contour, norms,
129 NULL, -6.0, 9.0, lasty);
134 /* ===================== END OF FILE ================== */