3 * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that (i) the above copyright notices and this permission notice appear in
8 * all copies of the software and related documentation, and (ii) the name of
9 * Silicon Graphics may not be used in any advertising or
10 * publicity relating to the software without the specific, prior written
11 * permission of Silicon Graphics.
13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
15 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18 * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
19 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
29 #include "glut_wrap.h"
32 #define PI 3.141592654
39 #define RD 0xA4,0x00,0x00,0xFF
40 #define WT 0xFF,0xFF,0xFF,0xFF
42 #define CHECKIMAGEWIDTH 8
43 #define CHECKIMAGEHEIGHT 8
44 #define BRICKIMAGEWIDTH 16
45 #define BRICKIMAGEHEIGHT 16
48 GLenum rgb
, doubleBuffer
;
52 float black
[3] = {0.0, 0.0, 0.0};
53 float white
[3] = {1.0, 1.0, 1.0};
54 float gray
[3] = {0.5, 0.5, 0.5};
55 float blue
[3] = {0.0, 0.0, 1.0};
56 GLint colorIndexes
[3] = {0, 200, 255};
63 GLboolean LineSmooth
= GL_FALSE
;
65 double plane
[4] = {1.0, 0.0, -1.0, 0.0};
66 float xRotation
= 30.0, yRotation
= 30.0;
67 float zTranslation
= -15.0;
73 GLubyte checkImage
[3*CHECKIMAGEWIDTH
*CHECKIMAGEHEIGHT
] = {
74 BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
,
75 WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
,
76 WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
,
77 BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
,
78 WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
,
79 WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
,
80 BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
,
81 WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
,
82 WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
,
83 BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
,
84 WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
,
85 WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
, WH
, WH
, WH
, BL
, BL
, BL
,
87 GLubyte brickImage
[4*BRICKIMAGEWIDTH
*BRICKIMAGEHEIGHT
] = {
88 RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
,
89 RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
,
90 RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
,
91 RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
,
92 WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
,
93 RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
,
94 RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
,
95 RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
,
96 RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
,
97 WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
,
98 RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
,
99 RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
,
100 RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
,
101 RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
,
102 WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
, WT
,
103 RD
, RD
, RD
, RD
, WT
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, RD
, WT
, RD
106 GLubyte
*image
= checkImage
;
107 GLint imageHeight
= CHECKIMAGEHEIGHT
;
108 GLint imageWidth
= CHECKIMAGEWIDTH
;
110 static float decal
[] = {
113 static float modulate
[] = {
116 static float repeat
[] = {
119 static float nearest
[] = {
123 GLubyte stipple
[4*32] = {
124 0x00, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00,
129 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x0F, 0xF0, 0x00,
134 0x00, 0x0F, 0xF0, 0x00,
135 0x00, 0x0F, 0xF0, 0x00,
136 0x00, 0x0F, 0xF0, 0x00,
137 0x00, 0x0F, 0xF0, 0x00,
138 0x00, 0x0F, 0xF0, 0x00,
139 0x00, 0x0F, 0xF0, 0x00,
140 0x00, 0x0F, 0xF0, 0x00,
142 0x00, 0x0F, 0xF0, 0x00,
143 0x00, 0x0F, 0xF0, 0x00,
144 0x00, 0x0F, 0xF0, 0x00,
145 0x00, 0x0F, 0xF0, 0x00,
146 0x00, 0x0F, 0xF0, 0x00,
147 0x00, 0x0F, 0xF0, 0x00,
148 0x00, 0x0F, 0xF0, 0x00,
149 0x00, 0x0F, 0xF0, 0x00,
151 0x00, 0x00, 0x00, 0x00,
152 0x00, 0x00, 0x00, 0x00,
153 0x00, 0x00, 0x00, 0x00,
154 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00,
156 0x00, 0x00, 0x00, 0x00,
157 0x00, 0x00, 0x00, 0x00,
158 0x00, 0x00, 0x00, 0x00,
161 float tscp
[18][2] = {
219 1.000000, 0.000000, 0.000000
222 1.000000, 0.000000, 5.000000
225 0.707107, 0.707107, 0.000000
228 0.707107, 0.707107, 5.000000
231 0.000000, 1.000000, 0.000000
234 0.000000, 1.000000, 5.000000
237 -0.707107, 0.707107, 0.000000
240 -0.707107, 0.707107, 5.000000
243 -1.000000, 0.000000, 0.000000
246 -1.000000, 0.000000, 5.000000
249 -0.707107, -0.707107, 0.000000
252 -0.707107, -0.707107, 5.000000
255 0.000000, -1.000000, 0.000000
258 0.000000, -1.000000, 5.000000
261 0.707107, -0.707107, 0.000000
264 0.707107, -0.707107, 5.000000
267 1.000000, 0.000000, 0.000000
270 1.000000, 0.000000, 5.000000
275 1.000000, 0.000000, 0.000000
278 1.000000, 0.000000, 7.000000
281 0.707107, 0.707107, 0.000000
284 0.707107, 0.707107, 7.000000
287 0.000000, 1.000000, 0.000000
290 0.000000, 1.000000, 7.000000
293 -0.707107, 0.707107, 0.000000
296 -0.707107, 0.707107, 7.000000
299 -1.000000, 0.000000, 0.000000
302 -1.000000, 0.000000, 7.000000
305 -0.707107, -0.707107, 0.000000
308 -0.707107, -0.707107, 7.000000
311 0.000000, -1.000000, 0.000000
314 0.000000, -1.000000, 7.000000
317 0.707107, -0.707107, 0.000000
320 0.707107, -0.707107, 7.000000
323 1.000000, 0.000000, 0.000000
326 1.000000, 0.000000, 7.000000
329 float ep
[7][9][3] = {
332 1.000000, 0.000000, 0.000000
335 0.707107, 0.707107, 0.000000
338 0.000000, 1.000000, 0.000000
341 -0.707107, 0.707107, 0.000000
344 -1.000000, 0.000000, 0.000000
347 -0.707107, -0.707107, 0.000000
350 0.000000, -1.000000, 0.000000
353 0.707107, -0.707107, 0.000000
356 1.000000, 0.000000, 0.000000
361 1.000000, 0.034074, 0.258819
364 0.707107, 0.717087, 0.075806
367 0.000000, 1.000000, 0.000000
370 -0.707107, 0.717087, 0.075806
373 -1.000000, 0.034074, 0.258819
376 -0.707107, -0.648939, 0.441832
379 0.000000, -0.931852, 0.517638
382 0.707107, -0.648939, 0.441832
385 1.000000, 0.034074, 0.258819
390 1.000000, 0.133975, 0.500000
393 0.707107, 0.746347, 0.146447
396 0.000000, 1.000000, 0.000000
399 -0.707107, 0.746347, 0.146447
402 -1.000000, 0.133975, 0.500000
405 -0.707107, -0.478398, 0.853553
408 0.000000, -0.732051, 1.000000
411 0.707107, -0.478398, 0.853553
414 1.000000, 0.133975, 0.500000
419 1.000000, 0.292893, 0.707107
422 0.707107, 0.792893, 0.207107
425 0.000000, 1.000000, 0.000000
428 -0.707107, 0.792893, 0.207107
431 -1.000000, 0.292893, 0.707107
434 -0.707107, -0.207107, 1.207107
437 0.000000, -0.414214, 1.414214
440 0.707107, -0.207107, 1.207107
443 1.000000, 0.292893, 0.707107
448 1.000000, 0.500000, 0.866025
451 0.707107, 0.853553, 0.253653
454 0.000000, 1.000000, 0.000000
457 -0.707107, 0.853553, 0.253653
460 -1.000000, 0.500000, 0.866025
463 -0.707107, 0.146447, 1.478398
466 0.000000, 0.000000, 1.732051
469 0.707107, 0.146447, 1.478398
472 1.000000, 0.500000, 0.866025
477 1.000000, 0.741181, 0.965926
480 0.707107, 0.924194, 0.282913
483 0.000000, 1.000000, 0.000000
486 -0.707107, 0.924194, 0.282913
489 -1.000000, 0.741181, 0.965926
492 -0.707107, 0.558168, 1.648939
495 0.000000, 0.482362, 1.931852
498 0.707107, 0.558168, 1.648939
501 1.000000, 0.741181, 0.965926
506 1.000000, 1.000000, 1.000000
509 0.707107, 1.000000, 0.292893
512 0.000000, 1.000000, 0.000000
515 -0.707107, 1.000000, 0.292893
518 -1.000000, 1.000000, 1.000000
521 -0.707107, 1.000000, 1.707107
524 0.000000, 1.000000, 2.000000
527 0.707107, 1.000000, 1.707107
530 1.000000, 1.000000, 1.000000
534 float en
[7][9][3] = {
537 1.000000, 0.000000, 0.000000
540 0.707107, 0.707107, 0.000000
543 0.000000, 1.000000, 0.000000
546 -0.707107, 0.707107, 0.000000
549 -1.000000, 0.000000, 0.000000
552 -0.707107, -0.707107, 0.000000
555 0.000000, -1.000000, 0.000000
558 0.707107, -0.707107, 0.000000
561 1.000000, 0.000000, 0.000000
566 1.000000, 0.000000, 0.000000
569 0.707107, 0.683013, -0.183013
572 0.000000, 0.965926, -0.258819
575 -0.707107, 0.683013, -0.183013
578 -1.000000, 0.000000, 0.000000
581 -0.707107, -0.683013, 0.183013
584 0.000000, -0.965926, 0.258819
587 0.707107, -0.683013, 0.183013
590 1.000000, 0.000000, 0.000000
595 1.000000, 0.000000, 0.000000
598 0.707107, 0.612372, -0.353553
601 0.000000, 0.866025, -0.500000
604 -0.707107, 0.612372, -0.353553
607 -1.000000, 0.000000, 0.000000
610 -0.707107, -0.612372, 0.353553
613 0.000000, -0.866025, 0.500000
616 0.707107, -0.612372, 0.353553
619 1.000000, 0.000000, 0.000000
624 1.000000, 0.000000, 0.000000
627 /* These 3 lines added by BEP */
628 0.707107, 0.500000, -0.500000
631 0.000000, 0.707107, -0.707107
634 -0.707107, 0.500000, -0.500000
637 -1.000000, 0.000000, 0.000000
640 -0.707107, -0.500000, 0.500000
643 0.000000, -0.707107, 0.707107
646 0.707107, -0.500000, 0.500000
649 1.000000, 0.000000, 0.000000
654 1.000000, 0.000000, 0.000000
657 0.707107, 0.353553, -0.612372
660 0.000000, 0.500000, -0.866025
663 -0.707107, 0.353553, -0.612372
666 -1.000000, 0.000000, 0.000000
669 -0.707107, -0.353553, 0.612372
672 0.000000, -0.500000, 0.866025
675 0.707107, -0.353553, 0.612372
678 1.000000, 0.000000, 0.000000
683 1.000000, 0.000000, 0.000000
686 0.707107, 0.183013, -0.683013
689 0.000000, 0.258819, -0.965926
692 -0.707107, 0.183013, -0.683013
695 -1.000000, 0.000000, 0.000000
698 -0.707107, -0.183013, 0.683013
701 0.000000, -0.258819, 0.965926
704 0.707107, -0.183013, 0.683013
707 1.000000, 0.000000, 0.000000
712 1.000000, 0.000000, 0.000000
715 0.707107, 0.000000, -0.707107
718 0.000000, 0.000000, -1.000000
721 -0.707107, 0.000000, -0.707107
724 -1.000000, 0.000000, 0.000000
727 -0.707107, 0.000000, 0.707107
730 0.000000, 0.000000, 1.000000
733 0.707107, 0.000000, 0.707107
736 1.000000, 0.000000, 0.000000
740 float tep
[7][9][2] = {
947 static void SetUpAntiAliasedGrayScale(void)
952 for (i
= 0; i
< 16; i
++) {
953 color
= (2 * i
+ 1) / 32.0;
954 for (j
= 0; j
< 16; j
++) {
955 glutSetColor(i
*16+j
, color
*j
/15.0, color
*j
/15.0, color
*j
/15.0);
960 static void BendForward(void)
963 glTranslatef(0.0, 1.0, 0.0);
964 glRotatef(90.0, 1, 0, 0);
965 glTranslatef(0.0, -1.0, 0.0);
968 static void BendLeft(void)
971 glRotatef(-90.0, 0, 0, 1);
972 glTranslatef(0.0, 1.0, 0.0);
973 glRotatef(90.0, 1, 0, 0);
974 glTranslatef(0.0, -1.0, 0.0);
977 static void BendRight(void)
980 glRotatef(90.0, 0, 0, 1);
981 glTranslatef(0.0, 1.0, 0.0);
982 glRotatef(90.0, 1, 0, 0);
983 glTranslatef(0.0, -1.0, 0.0);
986 static void BuildSingleCylinder(void)
989 glNewList(singleCylinder
, GL_COMPILE
);
991 glBegin(GL_TRIANGLE_STRIP
);
992 glNormal3fv(scp
[0]); glTexCoord2fv(tscp
[0]); glVertex3fv(scp
[0]);
993 glNormal3fv(scp
[0]); glTexCoord2fv(tscp
[1]); glVertex3fv(scp
[1]);
994 glNormal3fv(scp
[2]); glTexCoord2fv(tscp
[2]); glVertex3fv(scp
[2]);
995 glNormal3fv(scp
[2]); glTexCoord2fv(tscp
[3]); glVertex3fv(scp
[3]);
996 glNormal3fv(scp
[4]); glTexCoord2fv(tscp
[4]); glVertex3fv(scp
[4]);
997 glNormal3fv(scp
[4]); glTexCoord2fv(tscp
[5]); glVertex3fv(scp
[5]);
998 glNormal3fv(scp
[6]); glTexCoord2fv(tscp
[6]); glVertex3fv(scp
[6]);
999 glNormal3fv(scp
[6]); glTexCoord2fv(tscp
[7]); glVertex3fv(scp
[7]);
1000 glNormal3fv(scp
[8]); glTexCoord2fv(tscp
[8]); glVertex3fv(scp
[8]);
1001 glNormal3fv(scp
[8]); glTexCoord2fv(tscp
[9]); glVertex3fv(scp
[9]);
1002 glNormal3fv(scp
[10]); glTexCoord2fv(tscp
[10]); glVertex3fv(scp
[10]);
1003 glNormal3fv(scp
[10]); glTexCoord2fv(tscp
[11]); glVertex3fv(scp
[11]);
1004 glNormal3fv(scp
[12]); glTexCoord2fv(tscp
[12]); glVertex3fv(scp
[12]);
1005 glNormal3fv(scp
[12]); glTexCoord2fv(tscp
[13]); glVertex3fv(scp
[13]);
1006 glNormal3fv(scp
[14]); glTexCoord2fv(tscp
[14]); glVertex3fv(scp
[14]);
1007 glNormal3fv(scp
[14]); glTexCoord2fv(tscp
[15]); glVertex3fv(scp
[15]);
1008 glNormal3fv(scp
[16]); glTexCoord2fv(tscp
[16]); glVertex3fv(scp
[16]);
1009 glNormal3fv(scp
[16]); glTexCoord2fv(tscp
[17]); glVertex3fv(scp
[17]);
1015 static void BuildDoubleCylinder(void)
1018 glNewList(doubleCylinder
, GL_COMPILE
);
1020 glBegin(GL_TRIANGLE_STRIP
);
1021 glNormal3fv(dcp
[0]); glTexCoord2fv(tscp
[0]); glVertex3fv(dcp
[0]);
1022 glNormal3fv(dcp
[0]); glTexCoord2fv(tscp
[1]); glVertex3fv(dcp
[1]);
1023 glNormal3fv(dcp
[2]); glTexCoord2fv(tscp
[2]); glVertex3fv(dcp
[2]);
1024 glNormal3fv(dcp
[2]); glTexCoord2fv(tscp
[3]); glVertex3fv(dcp
[3]);
1025 glNormal3fv(dcp
[4]); glTexCoord2fv(tscp
[4]); glVertex3fv(dcp
[4]);
1026 glNormal3fv(dcp
[4]); glTexCoord2fv(tscp
[5]); glVertex3fv(dcp
[5]);
1027 glNormal3fv(dcp
[6]); glTexCoord2fv(tscp
[6]); glVertex3fv(dcp
[6]);
1028 glNormal3fv(dcp
[6]); glTexCoord2fv(tscp
[7]); glVertex3fv(dcp
[7]);
1029 glNormal3fv(dcp
[8]); glTexCoord2fv(tscp
[8]); glVertex3fv(dcp
[8]);
1030 glNormal3fv(dcp
[8]); glTexCoord2fv(tscp
[9]); glVertex3fv(dcp
[9]);
1031 glNormal3fv(dcp
[10]); glTexCoord2fv(tscp
[10]); glVertex3fv(dcp
[10]);
1032 glNormal3fv(dcp
[10]); glTexCoord2fv(tscp
[11]); glVertex3fv(dcp
[11]);
1033 glNormal3fv(dcp
[12]); glTexCoord2fv(tscp
[12]); glVertex3fv(dcp
[12]);
1034 glNormal3fv(dcp
[12]); glTexCoord2fv(tscp
[13]); glVertex3fv(dcp
[13]);
1035 glNormal3fv(dcp
[14]); glTexCoord2fv(tscp
[14]); glVertex3fv(dcp
[14]);
1036 glNormal3fv(dcp
[14]); glTexCoord2fv(tscp
[15]); glVertex3fv(dcp
[15]);
1037 glNormal3fv(dcp
[16]); glTexCoord2fv(tscp
[16]); glVertex3fv(dcp
[16]);
1038 glNormal3fv(dcp
[16]); glTexCoord2fv(tscp
[17]); glVertex3fv(dcp
[17]);
1044 static void BuildElbow(void)
1047 glNewList(elbow
, GL_COMPILE
);
1049 glBegin(GL_TRIANGLE_STRIP
);
1050 glNormal3fv(en
[0][0]); glTexCoord2fv(tep
[0][0]); glVertex3fv(ep
[0][0]);
1051 glNormal3fv(en
[1][0]); glTexCoord2fv(tep
[1][0]); glVertex3fv(ep
[1][0]);
1052 glNormal3fv(en
[0][1]); glTexCoord2fv(tep
[0][1]); glVertex3fv(ep
[0][1]);
1053 glNormal3fv(en
[1][1]); glTexCoord2fv(tep
[1][1]); glVertex3fv(ep
[1][1]);
1054 glNormal3fv(en
[0][2]); glTexCoord2fv(tep
[0][2]); glVertex3fv(ep
[0][2]);
1055 glNormal3fv(en
[1][2]); glTexCoord2fv(tep
[1][2]); glVertex3fv(ep
[1][2]);
1056 glNormal3fv(en
[0][3]); glTexCoord2fv(tep
[0][3]); glVertex3fv(ep
[0][3]);
1057 glNormal3fv(en
[1][3]); glTexCoord2fv(tep
[1][3]); glVertex3fv(ep
[1][3]);
1058 glNormal3fv(en
[0][4]); glTexCoord2fv(tep
[0][4]); glVertex3fv(ep
[0][4]);
1059 glNormal3fv(en
[1][4]); glTexCoord2fv(tep
[1][4]); glVertex3fv(ep
[1][4]);
1060 glNormal3fv(en
[0][5]); glTexCoord2fv(tep
[0][5]); glVertex3fv(ep
[0][5]);
1061 glNormal3fv(en
[1][5]); glTexCoord2fv(tep
[1][5]); glVertex3fv(ep
[1][5]);
1062 glNormal3fv(en
[0][6]); glTexCoord2fv(tep
[0][6]); glVertex3fv(ep
[0][6]);
1063 glNormal3fv(en
[1][6]); glTexCoord2fv(tep
[1][6]); glVertex3fv(ep
[1][6]);
1064 glNormal3fv(en
[0][7]); glTexCoord2fv(tep
[0][7]); glVertex3fv(ep
[0][7]);
1065 glNormal3fv(en
[1][7]); glTexCoord2fv(tep
[1][7]); glVertex3fv(ep
[1][7]);
1066 glNormal3fv(en
[0][8]); glTexCoord2fv(tep
[0][8]); glVertex3fv(ep
[0][8]);
1067 glNormal3fv(en
[1][8]); glTexCoord2fv(tep
[1][8]); glVertex3fv(ep
[1][8]);
1069 glBegin(GL_TRIANGLE_STRIP
);
1070 glNormal3fv(en
[1][0]); glTexCoord2fv(tep
[1][0]); glVertex3fv(ep
[1][0]);
1071 glNormal3fv(en
[2][0]); glTexCoord2fv(tep
[2][0]); glVertex3fv(ep
[2][0]);
1072 glNormal3fv(en
[1][1]); glTexCoord2fv(tep
[1][1]); glVertex3fv(ep
[1][1]);
1073 glNormal3fv(en
[2][1]); glTexCoord2fv(tep
[2][1]); glVertex3fv(ep
[2][1]);
1074 glNormal3fv(en
[1][2]); glTexCoord2fv(tep
[1][2]); glVertex3fv(ep
[1][2]);
1075 glNormal3fv(en
[2][2]); glTexCoord2fv(tep
[2][2]); glVertex3fv(ep
[2][2]);
1076 glNormal3fv(en
[1][3]); glTexCoord2fv(tep
[1][3]); glVertex3fv(ep
[1][3]);
1077 glNormal3fv(en
[2][3]); glTexCoord2fv(tep
[2][3]); glVertex3fv(ep
[2][3]);
1078 glNormal3fv(en
[1][4]); glTexCoord2fv(tep
[1][4]); glVertex3fv(ep
[1][4]);
1079 glNormal3fv(en
[2][4]); glTexCoord2fv(tep
[2][4]); glVertex3fv(ep
[2][4]);
1080 glNormal3fv(en
[1][5]); glTexCoord2fv(tep
[1][5]); glVertex3fv(ep
[1][5]);
1081 glNormal3fv(en
[2][5]); glTexCoord2fv(tep
[2][5]); glVertex3fv(ep
[2][5]);
1082 glNormal3fv(en
[1][6]); glTexCoord2fv(tep
[1][6]); glVertex3fv(ep
[1][6]);
1083 glNormal3fv(en
[2][6]); glTexCoord2fv(tep
[2][6]); glVertex3fv(ep
[2][6]);
1084 glNormal3fv(en
[1][7]); glTexCoord2fv(tep
[1][7]); glVertex3fv(ep
[1][7]);
1085 glNormal3fv(en
[2][7]); glTexCoord2fv(tep
[2][7]); glVertex3fv(ep
[2][7]);
1086 glNormal3fv(en
[1][8]); glTexCoord2fv(tep
[1][8]); glVertex3fv(ep
[1][8]);
1087 glNormal3fv(en
[2][8]); glTexCoord2fv(tep
[2][8]); glVertex3fv(ep
[2][8]);
1089 glBegin(GL_TRIANGLE_STRIP
);
1090 glNormal3fv(en
[2][0]); glTexCoord2fv(tep
[2][0]); glVertex3fv(ep
[2][0]);
1091 glNormal3fv(en
[3][0]); glTexCoord2fv(tep
[3][0]); glVertex3fv(ep
[3][0]);
1092 glNormal3fv(en
[2][1]); glTexCoord2fv(tep
[2][1]); glVertex3fv(ep
[2][1]);
1093 glNormal3fv(en
[3][1]); glTexCoord2fv(tep
[3][1]); glVertex3fv(ep
[3][1]);
1094 glNormal3fv(en
[2][2]); glTexCoord2fv(tep
[2][2]); glVertex3fv(ep
[2][2]);
1095 glNormal3fv(en
[3][2]); glTexCoord2fv(tep
[3][2]); glVertex3fv(ep
[3][2]);
1096 glNormal3fv(en
[2][3]); glTexCoord2fv(tep
[2][3]); glVertex3fv(ep
[2][3]);
1097 glNormal3fv(en
[3][3]); glTexCoord2fv(tep
[3][3]); glVertex3fv(ep
[3][3]);
1098 glNormal3fv(en
[2][4]); glTexCoord2fv(tep
[2][4]); glVertex3fv(ep
[2][4]);
1099 glNormal3fv(en
[3][4]); glTexCoord2fv(tep
[3][4]); glVertex3fv(ep
[3][4]);
1100 glNormal3fv(en
[2][5]); glTexCoord2fv(tep
[2][5]); glVertex3fv(ep
[2][5]);
1101 glNormal3fv(en
[3][5]); glTexCoord2fv(tep
[3][5]); glVertex3fv(ep
[3][5]);
1102 glNormal3fv(en
[2][6]); glTexCoord2fv(tep
[2][6]); glVertex3fv(ep
[2][6]);
1103 glNormal3fv(en
[3][6]); glTexCoord2fv(tep
[3][6]); glVertex3fv(ep
[3][6]);
1104 glNormal3fv(en
[2][7]); glTexCoord2fv(tep
[2][7]); glVertex3fv(ep
[2][7]);
1105 glNormal3fv(en
[3][7]); glTexCoord2fv(tep
[3][7]); glVertex3fv(ep
[3][7]);
1106 glNormal3fv(en
[2][8]); glTexCoord2fv(tep
[2][8]); glVertex3fv(ep
[2][8]);
1107 glNormal3fv(en
[3][8]); glTexCoord2fv(tep
[3][8]); glVertex3fv(ep
[3][8]);
1109 glBegin(GL_TRIANGLE_STRIP
);
1110 glNormal3fv(en
[3][0]); glTexCoord2fv(tep
[3][0]); glVertex3fv(ep
[3][0]);
1111 glNormal3fv(en
[4][0]); glTexCoord2fv(tep
[4][0]); glVertex3fv(ep
[4][0]);
1112 glNormal3fv(en
[3][1]); glTexCoord2fv(tep
[3][1]); glVertex3fv(ep
[3][1]);
1113 glNormal3fv(en
[4][1]); glTexCoord2fv(tep
[4][1]); glVertex3fv(ep
[4][1]);
1114 glNormal3fv(en
[3][2]); glTexCoord2fv(tep
[3][2]); glVertex3fv(ep
[3][2]);
1115 glNormal3fv(en
[4][2]); glTexCoord2fv(tep
[4][2]); glVertex3fv(ep
[4][2]);
1116 glNormal3fv(en
[3][3]); glTexCoord2fv(tep
[3][3]); glVertex3fv(ep
[3][3]);
1117 glNormal3fv(en
[4][3]); glTexCoord2fv(tep
[4][3]); glVertex3fv(ep
[4][3]);
1118 glNormal3fv(en
[3][4]); glTexCoord2fv(tep
[3][4]); glVertex3fv(ep
[3][4]);
1119 glNormal3fv(en
[4][4]); glTexCoord2fv(tep
[4][4]); glVertex3fv(ep
[4][4]);
1120 glNormal3fv(en
[3][5]); glTexCoord2fv(tep
[3][5]); glVertex3fv(ep
[3][5]);
1121 glNormal3fv(en
[4][5]); glTexCoord2fv(tep
[4][5]); glVertex3fv(ep
[4][5]);
1122 glNormal3fv(en
[3][6]); glTexCoord2fv(tep
[3][6]); glVertex3fv(ep
[3][6]);
1123 glNormal3fv(en
[4][6]); glTexCoord2fv(tep
[4][6]); glVertex3fv(ep
[4][6]);
1124 glNormal3fv(en
[3][7]); glTexCoord2fv(tep
[3][7]); glVertex3fv(ep
[3][7]);
1125 glNormal3fv(en
[4][7]); glTexCoord2fv(tep
[4][7]); glVertex3fv(ep
[4][7]);
1126 glNormal3fv(en
[3][8]); glTexCoord2fv(tep
[3][8]); glVertex3fv(ep
[3][8]);
1127 glNormal3fv(en
[4][8]); glTexCoord2fv(tep
[4][8]); glVertex3fv(ep
[4][8]);
1129 glBegin(GL_TRIANGLE_STRIP
);
1130 glNormal3fv(en
[4][0]); glTexCoord2fv(tep
[4][0]); glVertex3fv(ep
[4][0]);
1131 glNormal3fv(en
[5][0]); glTexCoord2fv(tep
[5][0]); glVertex3fv(ep
[5][0]);
1132 glNormal3fv(en
[4][1]); glTexCoord2fv(tep
[4][1]); glVertex3fv(ep
[4][1]);
1133 glNormal3fv(en
[5][1]); glTexCoord2fv(tep
[5][1]); glVertex3fv(ep
[5][1]);
1134 glNormal3fv(en
[4][2]); glTexCoord2fv(tep
[4][2]); glVertex3fv(ep
[4][2]);
1135 glNormal3fv(en
[5][2]); glTexCoord2fv(tep
[5][2]); glVertex3fv(ep
[5][2]);
1136 glNormal3fv(en
[4][3]); glTexCoord2fv(tep
[4][3]); glVertex3fv(ep
[4][3]);
1137 glNormal3fv(en
[5][3]); glTexCoord2fv(tep
[5][3]); glVertex3fv(ep
[5][3]);
1138 glNormal3fv(en
[4][4]); glTexCoord2fv(tep
[4][4]); glVertex3fv(ep
[4][4]);
1139 glNormal3fv(en
[5][4]); glTexCoord2fv(tep
[5][4]); glVertex3fv(ep
[5][4]);
1140 glNormal3fv(en
[4][5]); glTexCoord2fv(tep
[4][5]); glVertex3fv(ep
[4][5]);
1141 glNormal3fv(en
[5][5]); glTexCoord2fv(tep
[5][5]); glVertex3fv(ep
[5][5]);
1142 glNormal3fv(en
[4][6]); glTexCoord2fv(tep
[4][6]); glVertex3fv(ep
[4][6]);
1143 glNormal3fv(en
[5][6]); glTexCoord2fv(tep
[5][6]); glVertex3fv(ep
[5][6]);
1144 glNormal3fv(en
[4][7]); glTexCoord2fv(tep
[4][7]); glVertex3fv(ep
[4][7]);
1145 glNormal3fv(en
[5][7]); glTexCoord2fv(tep
[5][7]); glVertex3fv(ep
[5][7]);
1146 glNormal3fv(en
[4][8]); glTexCoord2fv(tep
[4][8]); glVertex3fv(ep
[4][8]);
1147 glNormal3fv(en
[5][8]); glTexCoord2fv(tep
[5][8]); glVertex3fv(ep
[5][8]);
1149 glBegin(GL_TRIANGLE_STRIP
);
1150 glNormal3fv(en
[5][0]); glTexCoord2fv(tep
[5][0]); glVertex3fv(ep
[5][0]);
1151 glNormal3fv(en
[6][0]); glTexCoord2fv(tep
[6][0]); glVertex3fv(ep
[6][0]);
1152 glNormal3fv(en
[5][1]); glTexCoord2fv(tep
[5][1]); glVertex3fv(ep
[5][1]);
1153 glNormal3fv(en
[6][1]); glTexCoord2fv(tep
[6][1]); glVertex3fv(ep
[6][1]);
1154 glNormal3fv(en
[5][2]); glTexCoord2fv(tep
[5][2]); glVertex3fv(ep
[5][2]);
1155 glNormal3fv(en
[6][2]); glTexCoord2fv(tep
[6][2]); glVertex3fv(ep
[6][2]);
1156 glNormal3fv(en
[5][3]); glTexCoord2fv(tep
[5][3]); glVertex3fv(ep
[5][3]);
1157 glNormal3fv(en
[6][3]); glTexCoord2fv(tep
[6][3]); glVertex3fv(ep
[6][3]);
1158 glNormal3fv(en
[5][4]); glTexCoord2fv(tep
[5][4]); glVertex3fv(ep
[5][4]);
1159 glNormal3fv(en
[6][4]); glTexCoord2fv(tep
[6][4]); glVertex3fv(ep
[6][4]);
1160 glNormal3fv(en
[5][5]); glTexCoord2fv(tep
[5][5]); glVertex3fv(ep
[5][5]);
1161 glNormal3fv(en
[6][5]); glTexCoord2fv(tep
[6][5]); glVertex3fv(ep
[6][5]);
1162 glNormal3fv(en
[5][6]); glTexCoord2fv(tep
[5][6]); glVertex3fv(ep
[5][6]);
1163 glNormal3fv(en
[6][6]); glTexCoord2fv(tep
[6][6]); glVertex3fv(ep
[6][6]);
1164 glNormal3fv(en
[5][7]); glTexCoord2fv(tep
[5][7]); glVertex3fv(ep
[5][7]);
1165 glNormal3fv(en
[6][7]); glTexCoord2fv(tep
[6][7]); glVertex3fv(ep
[6][7]);
1166 glNormal3fv(en
[5][8]); glTexCoord2fv(tep
[5][8]); glVertex3fv(ep
[5][8]);
1167 glNormal3fv(en
[6][8]); glTexCoord2fv(tep
[6][8]); glVertex3fv(ep
[6][8]);
1173 static void BuildLogo(void)
1176 glNewList(logo
, GL_COMPILE
);
1178 glTranslatef(5.5, -3.5, 4.5);
1179 glTranslatef(0.0, 0.0, -7.0);
1180 glCallList(doubleCylinder
);
1183 glTranslatef(0.0, 0.0, -7.0);
1184 glCallList(doubleCylinder
);
1187 glTranslatef(0.0, 0.0, -5.0);
1188 glCallList(singleCylinder
);
1191 glTranslatef(0.0, 0.0, -7.0);
1192 glCallList(doubleCylinder
);
1195 glTranslatef(0.0, 0.0, -7.0);
1196 glCallList(doubleCylinder
);
1199 glTranslatef(0.0, 0.0, -5.0);
1200 glCallList(singleCylinder
);
1203 glTranslatef(0.0, 0.0, -7.0);
1204 glCallList(doubleCylinder
);
1207 glTranslatef(0.0, 0.0, -7.0);
1208 glCallList(doubleCylinder
);
1211 glTranslatef(0.0, 0.0, -5.0);
1212 glCallList(singleCylinder
);
1215 glTranslatef(0.0, 0.0, -7.0);
1216 glCallList(doubleCylinder
);
1219 glTranslatef(0.0, 0.0, -7.0);
1220 glCallList(doubleCylinder
);
1223 glTranslatef(0.0, 0.0, -5.0);
1224 glCallList(singleCylinder
);
1227 glTranslatef(0.0, 0.0, -7.0);
1228 glCallList(doubleCylinder
);
1231 glTranslatef(0.0, 0.0, -7.0);
1232 glCallList(doubleCylinder
);
1235 glTranslatef(0.0, 0.0, -5.0);
1236 glCallList(singleCylinder
);
1239 glTranslatef(0.0, 0.0, -7.0);
1240 glCallList(doubleCylinder
);
1243 glTranslatef(0.0, 0.0, -7.0);
1244 glCallList(doubleCylinder
);
1247 glTranslatef(0.0, 0.0, -5.0);
1248 glCallList(singleCylinder
);
1255 static void BuildLists(void)
1258 singleCylinder
= glGenLists(1);
1259 doubleCylinder
= glGenLists(1);
1260 elbow
= glGenLists(1);
1261 logo
= glGenLists(1);
1263 BuildSingleCylinder();
1264 BuildDoubleCylinder();
1269 static void Init(void)
1271 static float ambient
[] = {0.1, 0.1, 0.1, 1.0};
1272 static float diffuse
[] = {0.5, 1.0, 1.0, 1.0};
1273 static float position
[] = {90.0, 90.0, 150.0, 0.0};
1274 static float front_mat_shininess
[] = {30.0};
1275 static float front_mat_specular
[] = {0.2, 0.2, 0.2, 1.0};
1276 static float front_mat_diffuse
[] = {0.5, 0.28, 0.38, 1.0};
1277 static float back_mat_shininess
[] = {50.0};
1278 static float back_mat_specular
[] = {0.5, 0.5, 0.2, 1.0};
1279 static float back_mat_diffuse
[] = {1.0, 1.0, 0.2, 1.0};
1280 static float lmodel_ambient
[] = {1.0, 1.0, 1.0, 1.0};
1281 static float lmodel_twoside
[] = {GL_TRUE
};
1283 glClearColor(0.0, 0.0, 0.0, 0.0);
1287 glEnable(GL_DEPTH_TEST
);
1289 glLightModelfv(GL_LIGHT_MODEL_AMBIENT
, lmodel_ambient
);
1290 glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE
, lmodel_twoside
);
1291 glLightfv(GL_LIGHT0
, GL_AMBIENT
, ambient
);
1292 glLightfv(GL_LIGHT0
, GL_DIFFUSE
, diffuse
);
1293 glLightfv(GL_LIGHT0
, GL_POSITION
, position
);
1294 glEnable(GL_LIGHTING
);
1295 glEnable(GL_LIGHT0
);
1297 glMaterialfv(GL_FRONT
, GL_SHININESS
, front_mat_shininess
);
1298 glMaterialfv(GL_FRONT
, GL_SPECULAR
, front_mat_specular
);
1299 glMaterialfv(GL_FRONT
, GL_DIFFUSE
, front_mat_diffuse
);
1300 glMaterialfv(GL_BACK
, GL_SHININESS
, back_mat_shininess
);
1301 glMaterialfv(GL_BACK
, GL_SPECULAR
, back_mat_specular
);
1302 glMaterialfv(GL_BACK
, GL_DIFFUSE
, back_mat_diffuse
);
1304 glEnable(GL_CLIP_PLANE0
);
1307 glTexEnvfv(GL_TEXTURE_ENV
, GL_TEXTURE_ENV_MODE
, decal
);
1308 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, repeat
);
1309 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, repeat
);
1310 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, nearest
);
1311 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, nearest
);
1312 glTexImage2D(GL_TEXTURE_2D
, 0, 3, CHECKIMAGEWIDTH
, CHECKIMAGEHEIGHT
, 0,
1313 GL_RGB
, GL_UNSIGNED_BYTE
, (GLvoid
*)checkImage
);
1314 glEnable(GL_TEXTURE_2D
);
1316 glCullFace(GL_BACK
);
1317 glEnable(GL_CULL_FACE
);
1320 /* commented out by BrianP because it's the wrong way to handle a 4-bit visual!
1322 colorIndexes[1] = 10;
1323 colorIndexes[2] = 15;
1326 glMaterialiv(GL_FRONT_AND_BACK
, GL_COLOR_INDEXES
, colorIndexes
);
1331 dithering
= GL_TRUE
;
1333 doStipple
= GL_FALSE
;
1337 static void Reshape(int width
, int height
)
1339 glViewport(0, 0, (GLint
)width
, (GLint
)height
);
1341 glMatrixMode(GL_PROJECTION
);
1343 gluPerspective(90, 1.0, 1.0, 200.0);
1344 glMatrixMode(GL_MODELVIEW
);
1347 static void Key2(int key
, int x
, int y
)
1355 case GLUT_KEY_RIGHT
:
1368 glutPostRedisplay();
1371 static void Key(unsigned char key
, int x
, int y
)
1380 zTranslation
-= 1.0;
1383 zTranslation
+= 1.0;
1387 glPolygonMode(polyMode
, GL_POINT
);
1390 glPolygonMode(polyMode
, GL_LINE
);
1393 glPolygonMode(polyMode
, GL_FILL
);
1398 polyMode
= GL_FRONT
;
1399 printf("PolygonMode GL_FRONT\n");
1402 polyMode
= GL_FRONT_AND_BACK
;
1403 printf("PolygonMode GL_FRONT_AND_BACK\n");
1405 case GL_FRONT_AND_BACK
:
1407 printf("PolygonMode GL_BACK\n");
1415 glHint(GL_POLYGON_SMOOTH_HINT
, GL_NICEST
);
1418 glEnable(GL_POLYGON_SMOOTH
);
1420 glBlendFunc(GL_SRC_ALPHA
, GL_ONE
);
1422 glDisable(GL_DEPTH_TEST
);
1424 SetUpAntiAliasedGrayScale();
1428 glDisable(GL_POLYGON_SMOOTH
);
1430 glBlendFunc(GL_ONE
, GL_ZERO
);
1431 glDisable(GL_BLEND
);
1432 glEnable(GL_DEPTH_TEST
);
1439 dithering
= !dithering
;
1440 (dithering
) ? glEnable(GL_DITHER
) : glDisable(GL_DITHER
);
1444 doStipple
= !doStipple
;
1446 glPolygonStipple(stipple
);
1447 glEnable(GL_POLYGON_STIPPLE
);
1449 glDisable(GL_POLYGON_STIPPLE
);
1455 (shade
) ? glShadeModel(GL_SMOOTH
) : glShadeModel(GL_FLAT
);
1459 glDisable(GL_CULL_FACE
);
1460 printf("disable culling\n");
1463 glEnable(GL_CULL_FACE
);
1464 glCullFace(GL_FRONT
);
1465 printf("enable front face culling\n");
1468 glEnable(GL_CULL_FACE
);
1469 glCullFace(GL_BACK
);
1470 printf("enable back face culling\n");
1477 glFrontFace(GL_CCW
);
1480 glPixelStorei(GL_UNPACK_ALIGNMENT
, 1);
1481 glPixelStorei(GL_UNPACK_LSB_FIRST
, 0);
1482 glPolygonStipple(stipple
);
1485 glPixelStorei(GL_UNPACK_ALIGNMENT
, 1);
1486 glPixelStorei(GL_UNPACK_LSB_FIRST
, 1);
1487 glPolygonStipple(stipple
);
1491 glEnable(GL_TEXTURE_2D
);
1492 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, repeat
);
1493 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, repeat
);
1494 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, nearest
);
1495 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, nearest
);
1496 glTexImage2D(GL_TEXTURE_2D
, 0, 4, BRICKIMAGEWIDTH
,
1497 BRICKIMAGEHEIGHT
, 0, GL_RGBA
, GL_UNSIGNED_BYTE
,
1498 (GLvoid
*)brickImage
);
1501 glEnable(GL_TEXTURE_2D
);
1502 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, repeat
);
1503 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, repeat
);
1504 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, nearest
);
1505 glTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, nearest
);
1506 glTexImage2D(GL_TEXTURE_2D
, 0, 3, CHECKIMAGEWIDTH
,
1507 CHECKIMAGEHEIGHT
, 0, GL_RGB
, GL_UNSIGNED_BYTE
,
1508 (GLvoid
*)checkImage
);
1511 glDisable(GL_TEXTURE_2D
);
1515 glTexEnvfv(GL_TEXTURE_ENV
, GL_TEXTURE_ENV_MODE
, decal
);
1518 glTexEnvfv(GL_TEXTURE_ENV
, GL_TEXTURE_ENV_MODE
, modulate
);
1522 /* added by BrianP */
1525 glDrawBuffer( GL_NONE
);
1529 glDrawBuffer( GL_BACK
);
1532 glDrawBuffer( GL_FRONT
);
1538 /* Line Smooth - added by BrianP */
1539 LineSmooth
= !LineSmooth
;
1541 glEnable(GL_LINE_SMOOTH
);
1542 glBlendFunc(GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
);
1546 glDisable(GL_LINE_SMOOTH
);
1547 glBlendFunc(GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
);
1548 glDisable(GL_BLEND
);
1555 glutPostRedisplay();
1558 static void Draw(void)
1561 glClear(GL_COLOR_BUFFER_BIT
|GL_DEPTH_BUFFER_BIT
);
1565 glTranslatef(0, 0, zTranslation
);
1566 glRotatef(30.0, 1, 0, 0);
1567 glRotatef(yRotation
, 0, 1, 0);
1568 glClipPlane(GL_CLIP_PLANE0
, plane
);
1580 static GLenum
Args(int argc
, char **argv
)
1585 doubleBuffer
= GL_FALSE
;
1587 for (i
= 1; i
< argc
; i
++) {
1588 if (strcmp(argv
[i
], "-ci") == 0) {
1590 } else if (strcmp(argv
[i
], "-rgb") == 0) {
1592 } else if (strcmp(argv
[i
], "-sb") == 0) {
1593 doubleBuffer
= GL_FALSE
;
1594 } else if (strcmp(argv
[i
], "-db") == 0) {
1595 doubleBuffer
= GL_TRUE
;
1597 printf("%s (Bad option).\n", argv
[i
]);
1604 int main(int argc
, char **argv
)
1608 glutInit(&argc
, argv
);
1610 if (Args(argc
, argv
) == GL_FALSE
) {
1614 glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
1617 type
|= (rgb
) ? GLUT_RGB
: GLUT_INDEX
;
1618 type
|= (doubleBuffer
) ? GLUT_DOUBLE
: GLUT_SINGLE
;
1619 glutInitDisplayMode(type
);
1621 if (glutCreateWindow("Logo Test") == GL_FALSE
) {
1629 glutReshapeFunc(Reshape
);
1630 glutKeyboardFunc(Key
);
1631 glutSpecialFunc(Key2
);
1632 glutDisplayFunc(Draw
);