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 #define NULL ((void *) 0x0)
25 /* =========================================================== */
28 #define CONTOUR(x,y) { \
29 double ax, ay, alen; \
30 contour[i][0] = SCALE * (x); \
31 contour[i][1] = SCALE * (y); \
33 ax = contour[i][0] - contour[i-1][0]; \
34 ay = contour[i][1] - contour[i-1][1]; \
35 alen = 1.0 / sqrt (ax*ax + ay*ay); \
36 ax *= alen; ay *= alen; \
37 norms [i-1][0] = ay; \
38 norms [i-1][1] = -ax; \
45 double contour [NUM_PTS][2];
46 double norms [NUM_PTS][2];
48 static void init_contour (void)
52 /* outline of extrusion */
78 CONTOUR (1.0, 1.0); /* repeat so that last normal is computed */
81 /* =========================================================== */
89 void InitStuff_screw (void)
93 /* configure the pipeline */
95 style |= TUBE_CONTOUR_CLOSED;
96 style |= TUBE_NORM_FACET;
97 style |= TUBE_JN_ANGLE;
98 gleSetJoinStyle (style);
103 /* =========================================================== */
105 void DrawStuff_screw (void) {
107 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
108 glColor3f (0.5, 0.6, 0.6);
110 /* set up some matrices so that the object spins with the mouse */
112 glTranslatef (0.0, 0.0, -80.0);
113 glRotatef(rot_x, 1, 0, 0);
114 glRotatef(rot_y, 0, 1, 0);
115 glRotatef(rot_z, 0, 0, 1);
116 /* glRotatef (130.0, 0.0, 1.0, 0.0); */
117 /* glRotatef (65.0, 1.0, 0.0, 0.0); */
119 /* draw the brand and the handle */
120 gleScrew (20, contour, norms,
121 NULL, -6.0, 9.0, lasty);
126 /* ===================== END OF FILE ================== */