1 #include <GL/glut.h>
2 #include <stdlib.h>
3 #include "Tischfunktionen.h"
4 
Tischflaeche()5 void Tischflaeche() {
6   GLint xteile=16;     // Anzahl muss gerade sein
7   GLint yteile=8;     // Anzahl muss gerade sein;
8 
9   GLfloat *vertices;
10   GLfloat *normals;
11   GLuint *indices;
12 
13   vertices = (GLfloat*) malloc (3*(xteile+1)*(yteile+1)* sizeof(GLfloat));
14   normals = (GLfloat*) malloc (3*(xteile+1)*(yteile+1)* sizeof(GLfloat));
15   indices = (GLuint*) malloc (4*xteile*yteile* sizeof(GLuint));
16 
17   glEnableClientState(GL_VERTEX_ARRAY);
18   glEnableClientState(GL_NORMAL_ARRAY);
19 
20   GLfloat widthx=264.0/xteile;
21   GLfloat widthy=137.0/yteile;
22 
23   GLint iv=0, in=0;
24   for (float x=0;x<=xteile;x++) {
25     for (float y=0;y<=yteile;y++) {
26       vertices[iv++]=-132+x*widthx;
27       vertices[iv++]=-68.5+y*widthy;
28       vertices[iv++]=0;
29 	  normals[in++]=0;
30       normals[in++]=0;
31       normals[in++]=1;
32      }
33   }
34 
35   GLint ii=0;
36   for (int xi=0;xi<xteile;xi++) {
37     for (int yi=0;yi<yteile;yi++) {
38       if (((yi==0)&&
39 	   ((xi==0)||(xi==(xteile/2)-1)||(xi==xteile/2)||(xi==xteile-1)))||
40 	  ((yi==yteile-1)&&
41 	   ((xi==0)||(xi==(xteile/2)-1)||(xi==xteile/2)||(xi==xteile-1))))
42 	   {continue;}
43       indices[ii++]=(yteile+1)*xi+yi;
44       indices[ii++]=(yteile+1)*(xi+1)+yi;
45       indices[ii++]=(yteile+1)*(xi+1)+yi+1;
46       indices[ii++]=(yteile+1)*xi+yi+1;
47     }
48   }
49 
50   glVertexPointer(3, GL_FLOAT, 0, vertices);
51   glNormalPointer(GL_FLOAT, 0, normals);
52 
53   glDrawElements(GL_QUADS,4*xteile*yteile-8*4 , GL_UNSIGNED_INT,indices);
54 
55   glDisableClientState(GL_VERTEX_ARRAY);
56   glDisableClientState(GL_NORMAL_ARRAY);
57 
58   free(vertices);
59   free(normals);
60   free(indices);
61  }
62 
TischflaechemitTextur()63 void TischflaechemitTextur() {
64   GLint xteile=16;     // Anzahl muss gerade sein
65   GLint yteile=8;     // Anzahl muss gerade sein;
66 
67   GLfloat *vertices;
68   GLfloat *normals;
69   GLfloat *texcoord;
70   GLuint *indices;
71 
72   vertices = (GLfloat*) malloc (3*(xteile+1)*(yteile+1)* sizeof(GLfloat));
73   normals = (GLfloat*) malloc (3*(xteile+1)*(yteile+1)* sizeof(GLfloat));
74   texcoord = (GLfloat*) malloc (2*(xteile+1)*(yteile+1)* sizeof(GLfloat));
75   indices = (GLuint*) malloc (4*xteile*yteile* sizeof(GLuint));
76 
77   glEnableClientState(GL_VERTEX_ARRAY);
78   glEnableClientState(GL_NORMAL_ARRAY);
79   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
80 
81   GLfloat widthx=264.0/xteile;
82   GLfloat widthy=137.0/yteile;
83 
84   GLint iv=0, in=0, it=0;
85   for (float x=0;x<=xteile;x++) {
86     for (float y=0;y<=yteile;y++) {
87       vertices[iv++]=-132+x*widthx;
88       vertices[iv++]=-68.5+y*widthy;
89       vertices[iv++]=0;
90 	  texcoord[it++]=(-132+x*widthx)/8.5;
91 	  texcoord[it++]=(-68.5+y*widthy)/8.5;
92       normals[in++]=0;
93       normals[in++]=0;
94       normals[in++]=1;
95      }
96   }
97 
98   GLint ii=0;
99   for (int xi=0;xi<xteile;xi++) {
100     for (int yi=0;yi<yteile;yi++) {
101       if (((yi==0)&&
102 	   ((xi==0)||(xi==(xteile/2)-1)||(xi==xteile/2)||(xi==xteile-1)))||
103 	  ((yi==yteile-1)&&
104 	   ((xi==0)||(xi==(xteile/2)-1)||(xi==xteile/2)||(xi==xteile-1))))
105 	   {continue;}
106       indices[ii++]=(yteile+1)*xi+yi;
107       indices[ii++]=(yteile+1)*(xi+1)+yi;
108       indices[ii++]=(yteile+1)*(xi+1)+yi+1;
109       indices[ii++]=(yteile+1)*xi+yi+1;
110     }
111   }
112 
113   glVertexPointer(3, GL_FLOAT, 0, vertices);
114   glNormalPointer(GL_FLOAT, 0, normals);
115   glTexCoordPointer(2, GL_FLOAT, 0, texcoord);
116 
117   glDrawElements(GL_QUADS,4*xteile*yteile-8*4 , GL_UNSIGNED_INT,indices);
118 
119   glDisableClientState(GL_VERTEX_ARRAY);
120   glDisableClientState(GL_NORMAL_ARRAY);
121   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
122 
123   free(vertices);
124   free(normals);
125   free(indices);
126   free(texcoord);
127  }
128 
129 
MittelLochVerkleidung()130 void MittelLochVerkleidung() {
131   GLfloat mat_ambient[]={0,0,0,1};
132   GLfloat mat_diffuse[]={.6,.45,0,1};
133   GLfloat mat_specular[]={2,2,2,2};
134   GLfloat mat_shininess = 127.0;
135   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_ambient);
136   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
137   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
138   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
139 
140 
141 
142 
143   GLfloat *vertices;
144   GLfloat *normals;
145   //  GLuint *indices;
146 
147   vertices = (GLfloat*) malloc (3*38*sizeof(GLfloat));
148   normals = (GLfloat*) malloc (3*38*sizeof(GLfloat));
149   //indices = (GLuint*) malloc (4*22*sizeof(GLint));
150 
151   glEnableClientState(GL_VERTEX_ARRAY);
152   glEnableClientState(GL_NORMAL_ARRAY);
153 
154   GLint iv=0;
155   GLint in=0;
156 
157   //0
158   vertices[iv++]=7.5;
159   vertices[iv++]=68.5;
160   vertices[iv++]=5;
161   normals[in++]=0;
162   normals[in++]=0;
163   normals[in++]=1;
164 
165   //1
166   vertices[iv++]=7.5;
167   vertices[iv++]=72.7;
168   vertices[iv++]=3.3+1.5;
169   normals[in++]=0;
170   normals[in++]=0.1;
171   normals[in++]=1;
172 
173   //2
174   vertices[iv++]=7.5;
175   vertices[iv++]=76.5;
176   vertices[iv++]=2.9+1.5;
177   normals[in++]=0;
178   normals[in++]=0.25;
179   normals[in++]=.97;
180 
181   //3
182   vertices[iv++]=7.5;
183   vertices[iv++]=80;
184   vertices[iv++]=2.1+1.5;
185   normals[in++]=0;
186   normals[in++]=.4;
187   normals[in++]=.91;
188 
189   //4
190   vertices[iv++]=3.75;
191   vertices[iv++]=80;
192   vertices[iv++]=2.1+1.5;
193   normals[in++]=0;
194   normals[in++]=.4;
195   normals[in++]=.91;
196 
197   //5
198   vertices[iv++]=0;
199   vertices[iv++]=80;
200   vertices[iv++]=2.1+1.5;
201   normals[in++]=0;
202   normals[in++]=.4;
203   normals[in++]=.91;
204 
205   //6
206   vertices[iv++]=-3.75;
207   vertices[iv++]=80;
208   vertices[iv++]=2.1+1.5;
209   normals[in++]=0;
210   normals[in++]=.4;
211   normals[in++]=.91;
212 
213   //7
214   vertices[iv++]=-7.5;
215   vertices[iv++]=80;
216   vertices[iv++]=2.1+1.5;
217   normals[in++]=0;
218   normals[in++]=.4;
219   normals[in++]=.91;
220 
221   //8
222   vertices[iv++]=-7.5;
223   vertices[iv++]=76.5;
224   vertices[iv++]=2.9+1.5;
225   normals[in++]=0;
226   normals[in++]=0.25;
227   normals[in++]=.97;
228 
229   //9
230   vertices[iv++]=-7.5;
231   vertices[iv++]=72.7;
232   vertices[iv++]=3.3+1.5;
233   normals[in++]=0;
234   normals[in++]=0.1;
235   normals[in++]=1;
236 
237   //10
238   vertices[iv++]=-7.5;
239   vertices[iv++]=68.5;
240   vertices[iv++]=5;
241   normals[in++]=0;
242   normals[in++]=0;
243   normals[in++]=1;
244 
245   //11
246   vertices[iv++]=6.5;
247   vertices[iv++]=68.5;
248   vertices[iv++]=5;
249   normals[in++]=0;
250   normals[in++]=0;
251   normals[in++]=1;
252 
253   //12
254   vertices[iv++]=5.6;
255   vertices[iv++]=72.7;
256   vertices[iv++]=3.3+1.5;
257   normals[in++]=0;
258   normals[in++]=.1;
259   normals[in++]=1;
260 
261   //13
262   vertices[iv++]=5;
263   vertices[iv++]=74.6;
264   vertices[iv++]=3.15+1.5;
265   normals[in++]=0;
266   normals[in++]=0.2;
267   normals[in++]=.97;
268 
269   //14
270   vertices[iv++]=3.75;
271   vertices[iv++]=76.25;
272   vertices[iv++]=2.9+1.5;
273   normals[in++]=0;
274   normals[in++]=0.25;
275   normals[in++]=.97;
276 
277   //15
278   vertices[iv++]=2.05;
279   vertices[iv++]=77.2;
280   vertices[iv++]=2.7+1.5;
281   normals[in++]=0;
282   normals[in++]=.3;
283   normals[in++]=.95;
284 
285   //16
286   vertices[iv++]=0;
287   vertices[iv++]=77.6;
288   vertices[iv++]=2.65+1.5;
289   normals[in++]=0;
290   normals[in++]=0.3;
291   normals[in++]=.95;
292 
293   //17
294   vertices[iv++]=-2.05;
295   vertices[iv++]=77.2;
296   vertices[iv++]=2.7+1.5;
297   normals[in++]=0;
298   normals[in++]=0.3;
299   normals[in++]=.95;
300 
301   //18
302   vertices[iv++]=-3.75;
303   vertices[iv++]=76.25;
304   vertices[iv++]=2.9+1.5;
305   normals[in++]=0;
306   normals[in++]=.25;
307   normals[in++]=.97;
308 
309   //19
310   vertices[iv++]=-5;
311   vertices[iv++]=74.6;
312   vertices[iv++]=3.15+1.5;
313   normals[in++]=0;
314   normals[in++]=0.25;
315   normals[in++]=.97;
316 
317   //20
318   vertices[iv++]=-5.6;
319   vertices[iv++]=72.7;
320   vertices[iv++]=3.3+1.5;
321   normals[in++]=0;
322   normals[in++]=0.1;
323   normals[in++]=1;
324 
325   //21
326   vertices[iv++]=-6.5;
327   vertices[iv++]=68.5;
328   vertices[iv++]=5;
329   normals[in++]=0;
330   normals[in++]=0;
331   normals[in++]=1;
332 
333   //22
334   vertices[iv++]=7.5;
335   vertices[iv++]=81.8;
336   vertices[iv++]=1.1+1.5;
337   normals[in++]=0;
338   normals[in++]=0.71;
339   normals[in++]=0.71;
340 
341   //23
342   vertices[iv++]=3.75;
343   vertices[iv++]=81.8;
344   vertices[iv++]=1.1+1.5;
345   normals[in++]=0;
346   normals[in++]=.71;
347   normals[in++]=.71;
348 
349   //24
350   vertices[iv++]=0;
351   vertices[iv++]=81.8;
352   vertices[iv++]=1.1+1.5;
353   normals[in++]=0;
354   normals[in++]=.71;
355   normals[in++]=.71;
356 
357   //25
358   vertices[iv++]=-3.75;
359   vertices[iv++]=81.8;
360   vertices[iv++]=1.1+1.5;
361   normals[in++]=0;
362   normals[in++]=.71;
363   normals[in++]=.71;
364 
365   //26
366   vertices[iv++]=-7.5;
367   vertices[iv++]=81.8;
368   vertices[iv++]=1.1+1.5;
369   normals[in++]=0;
370   normals[in++]=.71;
371   normals[in++]=.71;
372 
373   //27
374   vertices[iv++]=7.5;
375   vertices[iv++]=82.5;
376   vertices[iv++]=0.0+1.5;
377   normals[in++]=0;
378   normals[in++]=1;
379   normals[in++]=0;
380 
381   //28
382   vertices[iv++]=3.75;
383   vertices[iv++]=82.5;
384   vertices[iv++]=0.0+1.5;
385   normals[in++]=0;
386   normals[in++]=1;
387   normals[in++]=0;
388 
389   //29
390   vertices[iv++]=0;
391   vertices[iv++]=82.5;
392   vertices[iv++]=0.0+1.5;
393   normals[in++]=0;
394   normals[in++]=1;
395   normals[in++]=0;
396 
397   //30
398   vertices[iv++]=-3.75;
399   vertices[iv++]=82.5;
400   vertices[iv++]=0+1.5;
401   normals[in++]=0;
402   normals[in++]=1;
403   normals[in++]=0;
404 
405   //31
406   vertices[iv++]=-7.5;
407   vertices[iv++]=82.5;
408   vertices[iv++]=0+1.5;
409   normals[in++]=0;
410   normals[in++]=1;
411   normals[in++]=0;
412 
413   //32
414   vertices[iv++]=7.5;
415   vertices[iv++]=82.5;
416   vertices[iv++]=-10;
417   normals[in++]=0;
418   normals[in++]=1;
419   normals[in++]=0;
420 
421   //33
422   vertices[iv++]=3.75;
423   vertices[iv++]=82.5;
424   vertices[iv++]=-10;
425   normals[in++]=0;
426   normals[in++]=1;
427   normals[in++]=0;
428 
429   //34
430   vertices[iv++]=0;
431   vertices[iv++]=82.5;
432   vertices[iv++]=-10;
433   normals[in++]=0;
434   normals[in++]=1;
435   normals[in++]=0;
436 
437   //35
438   vertices[iv++]=-3.75;
439   vertices[iv++]=82.5;
440   vertices[iv++]=-10;
441   normals[in++]=0;
442   normals[in++]=1;
443   normals[in++]=0;
444 
445   //36
446   vertices[iv++]=-7.5;
447   vertices[iv++]=82.5;
448   vertices[iv++]=-10;
449   normals[in++]=0;
450   normals[in++]=1;
451   normals[in++]=0;
452 
453   GLuint indices[]={0,1,12,11,
454 	   1,2,13,12,
455 	   2,3,14,13,
456 	   3,4,15,14,
457 	   4,5,16,15,
458 	   5,6,17,16,
459 	   6,7,18,17,
460 	   7,8,19,18,
461 	   8,9,20,19,
462 	   9,10,21,20,
463 	   3,22,23,4,
464 	   4,23,24,5,
465 	   5,24,25,6,
466 	   6,25,26,7,
467 	   22,27,28,23,
468 	   23,28,29,24,
469 	   24,29,30,25,
470 	   25,30,31,26,
471 	   27,32,33,28,
472 	   28,33,34,29,
473 	   29,34,35,30,
474 	   30,35,36,31};
475 
476   glVertexPointer(3, GL_FLOAT, 0, vertices);
477   glNormalPointer(GL_FLOAT, 0, normals);
478 
479   glDrawElements(GL_QUADS,22*4 , GL_UNSIGNED_INT,indices);
480 
481   glDisableClientState(GL_VERTEX_ARRAY);
482   glDisableClientState(GL_NORMAL_ARRAY);
483 
484   free(vertices);
485   free(normals);
486   //free(indices);
487 
488 }
489 
EckLochVerkleidung()490 void EckLochVerkleidung() {
491 
492   GLfloat vertices[]={0,-9,5,
493 		      4.2,-9,4.8,
494 		      0,-8.2,5,
495 		      4.6,-3.2,4.8,
496 		      5.6,0,4.8,
497 		      5.2,2.1,4.8,
498 		      4,4,4.8,
499 		      2.1,5.2,4.8,
500 		      0,5.6,4.8,
501 		      -3.2,4.6,4.8,
502 		      -8.2,0,5,
503 		      -9,0,5,
504 		      -9,4.2,4.8,
505 		      8,-9,4.4,
506 		      8,-4.5,4.4,
507 		      8,0,4.4,
508 		      7.4,3,4.4,
509 		      5.7,5.7,4.4,
510 		      3,7.4,4.4,
511 		      0,8,4.4,
512 		      -4.5,8,4.4,
513 		      -9,8,4.4,
514 		      11.5,-9,3.6,
515 		      11.5,-4.5,3.6,
516 		      11.5,0,3.6,
517 		      10.6,4.4,3.6,
518 		      8.1,8.1,3.6,
519 		      4.4,10.6,3.6,
520 		      0,11.5,3.6,
521 		      -4.5,11.5,3.6,
522 		      -9,11.5,3.6,
523 		      13.3,-9,2.6,
524 		      13.3,-4.5,2.6,
525 		      13.3,0,2.6,
526 		      12.2,5.1,2.6,
527 		      9.4,9.4,2.6,
528 		      5.1,12.2,2.6,
529 		      0,13.3,2.6,
530 		      -4.5,13.3,2.6,
531 		      -9,13.3,2.6,
532 		      14,-9,1.5,
533 		      14,-4.5,1.5,
534 		      14,0,1.5,
535 		      12.9,5.3,1.5,
536 		      9.9,9.9,1.5,
537 		      5.3,12.9,1.5,
538 		      0,14,1.5,
539 		      -4.5,14,1.5,
540 		      -9,14,1.5,
541 		      14,-9,-10,
542 		      14,-4.5,-10,
543 		      14,0,-10,
544 		      12.9,5.3,-10,
545 		      9.9,9.9,-10,
546 		      5.3,12.9,-10,
547 		      0,14,-10,
548 		      -4.5,14,-10,
549 		      -9,14,-10};
550 
551   GLfloat normals[]={0,0,1,
552 		     0.1,0,1,
553 		     0,0,1,
554 		     0.1,0,1,
555 		     0.1,0,1,
556 		     0.08,0.01,1,
557 		     0.07,0.07,1,
558 		     0.01,0.08,1,
559 		     0,0.1,1,
560 		     0,0.1,1,
561 		     0,0,1,
562 		     0,0,1,
563 		     0,0.1,1,
564 		     .25,0,.97,
565 		     .25,0,.97,
566 		     .25,0,.97,
567 		     .23,.1,.97,
568 		     .17,.17,.97,
569 		     .1,.23,.97,
570 		     0,.25,.97,
571 		     0,.25,.97,
572 		     0,.25,.97,
573 		     .4,0,.91,
574 		     .4,0,.91,
575 		     .4,0,.91,
576 		     .37,.15,.91,
577 		     .28,.28,.91,
578 		     .15,.37,.91,
579 		     0,.4,.91,
580 		     0,.4,.91,
581 		     0,.4,.91,
582 		     .71,0,.71,
583 		     .71,0,.71,
584 		     .71,0,.71,
585 		     .66,.27,.71,
586 		     .5,.5,.71,
587 		     .27,.66,.71,
588 		     0,.71,.71,
589 		     0,.71,.71,
590 		     0,.71,.71,
591 		     1,0,0,
592 		     1,0,0,
593 		     1,0,0,
594 		     .92,.38,0,
595 		     .71,.71,0,
596 		     0.38,.92,0,
597 		     0,1,0,
598 		     0,1,0,
599 		     0,1,0,
600 		     1,0,0,
601 		     1,0,0,
602 		     1,0,0,
603 		     .92,.38,0,
604 		     .71,.71,0,
605 		     0.38,.92,0,
606 		     0,1,0,
607 		     0,1,0,
608 		     0,1,0};
609 
610   GLuint indices[]={0,1,3,2,
611 		    1,13,14,3,
612 		    3,14,15,4,
613 		    4,15,16,5,
614 		    5,16,17,6,
615 		    6,17,18,7,
616 		    7,18,19,8,
617 		    8,19,20,9,
618 		    9,20,21,12,
619 		    9,12,11,10,
620 		    13,22,23,14,
621 		    14,23,24,15,
622 		    15,24,25,16,
623 		    16,25,26,17,
624 		    17,26,27,18,
625 		    18,27,28,19,
626 		    19,28,29,20,
627 		    20,29,30,21,
628 		    22,31,32,23,
629 		    23,32,33,24,
630 		    24,33,34,25,
631 		    25,34,35,26,
632 		    26,35,36,27,
633 		    27,36,37,28,
634 		    28,37,38,29,
635 		    29,38,39,30,
636 		    31,40,41,32,
637 		    32,41,42,33,
638 		    33,42,43,34,
639 		    34,43,44,35,
640 		    35,44,45,36,
641 		    36,45,46,37,
642 		    37,46,47,38,
643 		    38,47,48,39,
644                     40,49,50,41,
645 		    41,50,51,42,
646 		    42,51,52,43,
647 		    43,52,53,44,
648 		    44,53,54,45,
649 		    45,54,55,46,
650 		    46,55,56,47,
651 		    47,56,57,48};
652 
653   GLfloat mat_ambient[]={0,0,0,1};
654   GLfloat mat_diffuse[]={.6,.45,0,1};
655   GLfloat mat_specular[]={2,2,2,2};
656   GLfloat mat_shininess = 127.0;
657   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_ambient);
658   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
659   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
660   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
661 
662   glEnableClientState(GL_VERTEX_ARRAY);
663   glEnableClientState(GL_NORMAL_ARRAY);
664 
665   glVertexPointer(3, GL_FLOAT, 0, vertices);
666   glNormalPointer(GL_FLOAT, 0, normals);
667 
668   glDrawElements(GL_QUADS,42*4 , GL_UNSIGNED_INT,indices);
669 
670   glDisableClientState(GL_VERTEX_ARRAY);
671   glDisableClientState(GL_NORMAL_ARRAY);
672 }
673 
MittelLochInnenverkleidung()674 void MittelLochInnenverkleidung() {
675 
676   GLfloat vertices[]={6.5,68.5,5,
677 		      5.6,72.7,4.8,
678 		      5,74.6,4.65,
679 		      3.75,76.25,4.4,
680 		      2.05,77.2,4.2,
681 		      0,77.6,4.15,
682 		      -2.05,77.2,4.2,
683 		      -3.75,76.25,4.4,
684 		      -5,74.6,4.65,
685 		      -5.6,72.7,4.8,
686 		      -6.5,68.5,5,
687 		      6.5,68.5,2.5,
688 		      7.1,74.2,2.5,
689 		      6.2,75.5,2.5,
690 		      4.6,77.2,2.5,
691 		      2.8,78.4,2.5,
692 		      0,79,2.5,
693 		      -2.8,78.4,2.5,
694 		      -4.6,77.2,2.5,
695 		      -6.2,75.5,2.5,
696 		      -7.1,74.2,2.5,
697 		      -6.5,68.5,2.5,
698 		      6.5,68.5,-10,
699 		      7.1,74.2,-10,
700 		      6.2,75.5,-10,
701 		      4.6,77.2,-10,
702 		      2.8,78.4,-10,
703 		      0,79,-10,
704 		      -2.8,78.4,-10,
705 		      -4.6,77.2,-10,
706 		      -6.2,75.5,-10,
707 		      -7.1,74.2,-10,
708 		      -6.5,68.5,-10};
709 
710   GLfloat normals[]={-5.8,-1,-5,
711 		     -5.8,-1,-5,
712 		     -4,-2.8,-5,
713 		     -3.8,-4.4,-5,
714 		     -2,-5.6,-5,
715 		     0,-5.8,-5,
716 		     2,-5.6,-5,
717 		     3.8,-4.4,-5,
718 		     4,-2.8,-5,
719 		     5.8,-1,-5,
720 		     5.8,-1,-5,
721 		     -6.5,3.2,0,
722 		     -7.1,-.9,0,
723 		     -6.2,-3.8,0,
724 		     -4.6,-5.5,0,
725 		     -2.8,-6.8,0,
726 		     0,-7.2,0,
727 		     2.8,-6.8,0,
728 		     4.6,-5.5,0,
729 		     6.2,-3.8,0,
730 		     7.1,-.9,0,
731 		     -6.5,3.2,0,
732 		     -6.5,3.2,0,
733 		     -7.1,-.9,0,
734 		     -6.2,-3.8,0,
735 		     -4.6,-5.5,0,
736 		     -2.8,-6.8,0,
737 		     0,-7.2,0,
738 		     2.8,-6.8,0,
739 		     4.6,-5.5,0,
740 		     6.2,-3.8,0,
741 		     7.1,-.9,0,
742 		     -6.5,3.2,0};
743 
744   GLint indices[]={0,1,12,11,
745 		   1,2,13,12,
746 		   2,3,14,13,
747 		   3,4,15,14,
748 		   4,5,16,15,
749 		   5,6,17,16,
750 		   6,7,18,17,
751 		   7,8,19,18,
752 		   8,9,20,19,
753 		   9,10,21,20,
754 		   11,12,23,22,
755 		   12,13,24,23,
756 		   13,14,25,24,
757 		   14,15,26,25,
758 		   15,16,27,26,
759 		   16,17,28,27,
760 		   17,18,29,28,
761 		   18,19,30,29,
762 		   19,20,31,30,
763 		   20,21,32,31};
764 
765   GLfloat mat_ambient[]={0,0,0,1.0};
766   GLfloat mat_diffuse[]={.3,.3,.3,1};
767   GLfloat mat_specular[]={10.0,10.0,10.0,10.0};
768   GLfloat mat_shininess = 127.0;
769 
770   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_ambient);
771   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
772   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
773   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
774 
775 
776   glEnableClientState(GL_VERTEX_ARRAY);
777   glEnableClientState(GL_NORMAL_ARRAY);
778 
779   glVertexPointer(3, GL_FLOAT, 0, vertices);
780   glNormalPointer(GL_FLOAT, 0, normals);
781 
782   glDrawElements(GL_QUADS,4*20, GL_UNSIGNED_INT,indices);
783 
784   glDisableClientState(GL_VERTEX_ARRAY);
785   glDisableClientState(GL_NORMAL_ARRAY);
786 
787 }
788 
EckLochInnenverkleidung()789 void EckLochInnenverkleidung() {
790 
791   GLfloat vertices[]={0,-8.2,5,
792 		      4.6,-3.2,4.8,
793 		      5.6,0,4.8,
794 		      5.2,2.1,4.8,
795 		      4,4,4.8,
796 		      2.1,5.2,4.8,
797 		      0,5.6,4.8,
798 		      -3.2,4.6,4.8,
799 		      -8.2,0,5,
800 		      0,-8.2,2.5,
801 		      5.7,-4,2.5,
802 		      6.3,0,2.5,
803 		      5.7,2.3,2.5,
804 		      4.3,4.3,2.5,
805 		      2.3,5.7,2.5,
806 		      0,6.3,2.5,
807 		      -4,5.7,2.5,
808 		      -8.2,0,2.5,
809 		      0,-8.2,-10,
810 		      5.7,-4,-10,
811 		      6.3,0,-10,
812 		      5.7,2.3,-10,
813 		      4.3,4.3,-10,
814 		      2.3,5.7,-10,
815 		      0,6.3,-10,
816 		      -4,5.7,-10,
817 		      -8.2,0,-10};
818 
819   GLfloat normals[]={0,8.2,-5,
820 		     -4.6,3.2,-4.8,
821 		     -5.6,0,-4.8,
822 		     -5.2,-2.1,-4.8,
823 		     -4,-4,-4.8,
824 		     -2.1,-5.2,-4.8,
825 		     0,-5.6,-4.8,
826 		     3.2,-4.6,-4.8,
827 		     8.2,0,-5,
828 		     0,8.2,0,
829 		     -5.7,4,0,
830 		     -6.3,0,0,
831 		     -5.7,-2.3,0,
832 		     -4.3,-4.3,0,
833 		     -2.3,-5.7,0,
834 		     0,-6.3,0,
835 		     4,-5.7,0,
836 		     8.2,0,0,
837 		     0,8.2,0,
838 		     -5.7,4,0,
839 		     -6.3,0,0,
840 		     -5.7,-2.3,0,
841 		     -4.3,-4.3,0,
842 		     -2.3,-5.7,0,
843 		     0,-6.3,0,
844 		     4,-5.7,0,
845 		     8.2,0,0,};
846 
847   GLint indices[]={0,1,10,9,
848 		   1,2,11,10,
849 		   2,3,12,11,
850 		   3,4,13,12,
851 		   4,5,14,13,
852 		   5,6,15,14,
853 		   6,7,16,15,
854 		   7,8,17,16,
855 		   9,10,19,18,
856 		   10,11,20,19,
857 		   11,12,21,20,
858 		   12,13,22,21,
859 		   13,14,23,22,
860 		   14,15,24,23,
861 		   15,16,25,24,
862 		   16,17,26,25};
863 
864   GLfloat mat_ambient[]={0,0,0,1.0};
865   GLfloat mat_diffuse[]={.3,.3,.3,1};
866   GLfloat mat_specular[]={10.0,10.0,10.0,10.0};
867   GLfloat mat_shininess = 127.0;
868 
869 
870   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_ambient);
871   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
872   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
873   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
874 
875 
876   glEnableClientState(GL_VERTEX_ARRAY);
877   glEnableClientState(GL_NORMAL_ARRAY);
878 
879   glVertexPointer(3, GL_FLOAT, 0, vertices);
880   glNormalPointer(GL_FLOAT, 0, normals);
881 
882   glDrawElements(GL_QUADS,4*16, GL_UNSIGNED_INT,indices);
883 
884   glDisableClientState(GL_VERTEX_ARRAY);
885   glDisableClientState(GL_NORMAL_ARRAY);
886 
887 
888 }
889 
890 
Holzbande(GLfloat Breite,GLint Unterteilungen,GLfloat TexFaktorX,GLfloat TexFaktorY)891 void Holzbande(GLfloat Breite, GLint Unterteilungen, GLfloat TexFaktorX, GLfloat TexFaktorY) {
892 
893   GLfloat mat_diffuse[]={1.0,1.0,1.0,1.0};
894   GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
895   GLfloat mat_shininess = 127.0;
896 
897   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_diffuse);
898   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
899   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
900   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
901 
902   GLfloat *vertices;
903   GLfloat *normals;
904   GLuint *indices;
905   GLfloat *texcoord;
906 
907   vertices = (GLfloat*) malloc (3*7*(Unterteilungen+1)* sizeof(GLfloat));
908   normals = (GLfloat*) malloc (3*7*(Unterteilungen+1)* sizeof(GLfloat));
909   indices = (GLuint*) malloc (1000+4*6*Unterteilungen* sizeof(GLuint));
910   texcoord = (GLfloat*) malloc (2*7*(Unterteilungen+1)* sizeof(GLfloat));
911 
912   GLfloat TeilBreite=Breite/Unterteilungen;
913 
914   int iv=0; int in=0; int ii=0; int it=0;
915 
916   glEnableClientState(GL_VERTEX_ARRAY);
917   glEnableClientState(GL_NORMAL_ARRAY);
918   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
919 
920   for (GLint u=0;u<=Unterteilungen;u++) {
921     vertices[iv++]=u*TeilBreite;
922     vertices[iv++]=0;
923     vertices[iv++]=5;
924     normals[in++]=0;
925     normals[in++]=0;
926     normals[in++]=1;
927     texcoord[it++]=u*TexFaktorX/Unterteilungen;
928     texcoord[it++]=0;
929 
930     vertices[iv++]=u*TeilBreite;
931     vertices[iv++]=4.2;
932     vertices[iv++]=4.8;
933     normals[in++]=0;
934     normals[in++]=.1;
935     normals[in++]=1;
936     texcoord[it++]=u*TexFaktorX/Unterteilungen;
937     texcoord[it++]=.3*TexFaktorY;
938 
939     vertices[iv++]=u*TeilBreite;
940     vertices[iv++]=8;
941     vertices[iv++]=4.4;
942     normals[in++]=0;
943     normals[in++]=.25;
944     normals[in++]=.97;
945     texcoord[it++]=u*TexFaktorX/Unterteilungen;
946     texcoord[it++]=.57*TexFaktorY;
947 
948     vertices[iv++]=u*TeilBreite;
949     vertices[iv++]=11.5;
950     vertices[iv++]=3.6;
951     normals[in++]=0;
952     normals[in++]=.4;
953     normals[in++]=.91;
954     texcoord[it++]=u*TexFaktorX/Unterteilungen;
955     texcoord[it++]=.82*TexFaktorY;
956 
957     vertices[iv++]=u*TeilBreite;
958     vertices[iv++]=13.3;
959     vertices[iv++]=2.6;
960     normals[in++]=0;
961     normals[in++]=.71;
962     normals[in++]=.71;
963     texcoord[it++]=u*TexFaktorX/Unterteilungen;
964     texcoord[it++]=.95*TexFaktorY;
965 
966     vertices[iv++]=u*TeilBreite;
967     vertices[iv++]=14;
968     vertices[iv++]=1.5;
969     normals[in++]=0;
970     normals[in++]=1;
971     normals[in++]=0;
972     texcoord[it++]=u*TexFaktorX/Unterteilungen;
973     texcoord[it++]=TexFaktorY;
974 
975     vertices[iv++]=u*TeilBreite;
976     vertices[iv++]=14;
977     vertices[iv++]=-10;
978     normals[in++]=0;
979     normals[in++]=1;
980     normals[in++]=0;
981     texcoord[it++]=u*TexFaktorX/Unterteilungen;
982     texcoord[it++]=.5*TexFaktorY;
983   }
984 
985   for (GLint y=0;y<6;y++) {
986     for (GLint x=0;x<Unterteilungen;x++) {
987       indices[ii++]=x*7+y+1;
988       indices[ii++]=x*7+y;
989       indices[ii++]=(x+1)*7+y;
990       indices[ii++]=(x+1)*7+y+1;
991     }
992   }
993 
994   glNormalPointer(GL_FLOAT, 0, normals);
995   glVertexPointer(3, GL_FLOAT, 0, vertices);
996   glTexCoordPointer(2, GL_FLOAT, 0, texcoord);
997 
998   glDrawElements(GL_QUADS,4*6*Unterteilungen, GL_UNSIGNED_INT,indices);
999 
1000   glDisableClientState(GL_VERTEX_ARRAY);
1001   glDisableClientState(GL_NORMAL_ARRAY);
1002   glDisableClientState(GL_TEXTURE_COORD_ARRAY);
1003 
1004   free(vertices);
1005   free(normals);
1006   free(indices);
1007   free(texcoord);
1008 }
1009 
HolzbandeOT(GLfloat Breite,GLint Unterteilungen)1010 void HolzbandeOT(GLfloat Breite, GLint Unterteilungen) {
1011 
1012   GLfloat mat_diffuse[]={.45,.19,.03,1.0};
1013   GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
1014   GLfloat mat_shininess = 127.0;
1015 
1016   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_diffuse);
1017   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
1018   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
1019   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
1020 
1021   GLfloat *vertices;
1022   GLfloat *normals;
1023   GLuint *indices;
1024 
1025   vertices = (GLfloat*) malloc (3*7*(Unterteilungen+1)* sizeof(GLfloat));
1026   normals = (GLfloat*) malloc (3*7*(Unterteilungen+1)* sizeof(GLfloat));
1027   indices = (GLuint*) malloc (1000+4*6*Unterteilungen* sizeof(GLuint));
1028 
1029   GLfloat TeilBreite=Breite/Unterteilungen;
1030 
1031   int iv=0; int in=0; int ii=0;
1032 
1033   glEnableClientState(GL_VERTEX_ARRAY);
1034   glEnableClientState(GL_NORMAL_ARRAY);
1035 
1036   for (GLint u=0;u<=Unterteilungen;u++) {
1037     vertices[iv++]=u*TeilBreite;
1038     vertices[iv++]=0;
1039     vertices[iv++]=5;
1040     normals[in++]=0;
1041     normals[in++]=0;
1042     normals[in++]=1;
1043 
1044     vertices[iv++]=u*TeilBreite;
1045     vertices[iv++]=4.2;
1046     vertices[iv++]=4.8;
1047     normals[in++]=0;
1048     normals[in++]=.1;
1049     normals[in++]=1;
1050 
1051     vertices[iv++]=u*TeilBreite;
1052     vertices[iv++]=8;
1053     vertices[iv++]=4.4;
1054     normals[in++]=0;
1055     normals[in++]=.25;
1056     normals[in++]=.97;
1057 
1058     vertices[iv++]=u*TeilBreite;
1059     vertices[iv++]=11.5;
1060     vertices[iv++]=3.6;
1061     normals[in++]=0;
1062     normals[in++]=.4;
1063     normals[in++]=.91;
1064 
1065     vertices[iv++]=u*TeilBreite;
1066     vertices[iv++]=13.3;
1067     vertices[iv++]=2.6;
1068     normals[in++]=0;
1069     normals[in++]=.71;
1070     normals[in++]=.71;
1071 
1072     vertices[iv++]=u*TeilBreite;
1073     vertices[iv++]=14;
1074     vertices[iv++]=1.5;
1075     normals[in++]=0;
1076     normals[in++]=1;
1077     normals[in++]=0;
1078 
1079     vertices[iv++]=u*TeilBreite;
1080     vertices[iv++]=14;
1081     vertices[iv++]=-10;
1082     normals[in++]=0;
1083     normals[in++]=1;
1084     normals[in++]=0;
1085   }
1086 
1087   for (GLint y=0;y<6;y++) {
1088     for (GLint x=0;x<Unterteilungen;x++) {
1089       indices[ii++]=x*7+y+1;
1090       indices[ii++]=x*7+y;
1091       indices[ii++]=(x+1)*7+y;
1092       indices[ii++]=(x+1)*7+y+1;
1093     }
1094   }
1095 
1096   glNormalPointer(GL_FLOAT, 0, normals);
1097   glVertexPointer(3, GL_FLOAT, 0, vertices);
1098 
1099   glDrawElements(GL_QUADS,4*6*Unterteilungen, GL_UNSIGNED_INT,indices);
1100 
1101   glDisableClientState(GL_VERTEX_ARRAY);
1102   glDisableClientState(GL_NORMAL_ARRAY);
1103 
1104   free(vertices);
1105   free(normals);
1106   free(indices);
1107 }
1108 
Banden(GLint richtung,GLint Multiply)1109 void Banden(GLint richtung, GLint Multiply){
1110 // Banden berechnen
1111 
1112 //richtung=0 --> Banden links und rechts
1113 //richtung=1 --> Banden oben und unten
1114 
1115    GLfloat *vertices;
1116    GLfloat *normals;
1117    GLuint *indices;
1118 
1119    vertices = (GLfloat*) malloc (3*8* sizeof(GLfloat));
1120    normals = (GLfloat*) malloc (3*8* sizeof(GLfloat));
1121    indices = (GLuint*) malloc (4*6* sizeof(GLfloat));
1122 
1123 // Banden links und rechts
1124 
1125    if (richtung==0) {
1126 
1127    vertices[0]=-132;       // Punkt 0
1128    vertices[1]=-60.3;
1129    vertices[2]=0;
1130    normals[0]=3.429;
1131    normals[1]=-1;
1132    normals[2]=-5;
1133 
1134    vertices[3]=-127;       // Punkt 1
1135    vertices[4]=-53.56;
1136    vertices[5]=3.429;
1137    normals[3]=3.429;
1138    normals[4]=-1;
1139    normals[5]=-5;
1140 
1141    vertices[6]=-127;        // Punkt 2
1142    vertices[7]=-53.56;
1143    vertices[8]=3.829;
1144    normals[6]=1.371;
1145    normals[7]=-1;
1146    normals[8]=5;
1147 
1148    vertices[9]=-132;        // Punkt 3
1149    vertices[10]=-60.3;
1150    vertices[11]=5;
1151    normals[9]=-3.829;
1152    normals[10]=-1;
1153    normals[11]=5;
1154 
1155    vertices[12]=-132;       // Punkt 4
1156    vertices[13]=60.3;
1157    vertices[14]=0;
1158    normals[12]=3.429;
1159    normals[13]=1;
1160    normals[14]=-5;
1161 
1162    vertices[15]=-127;       // Punkt 5
1163    vertices[16]=53.56;
1164    vertices[17]=3.429;
1165    normals[15]=3.429;
1166    normals[16]=1;
1167    normals[17]=-5;
1168 
1169    vertices[18]=-127;       // Punkt 6
1170    vertices[19]=53.56;
1171    vertices[20]=3.829;
1172    normals[18]=1.371;
1173    normals[19]=1;
1174    normals[20]=5;
1175 
1176    vertices[21]=-132;       // Punkt 7
1177    vertices[22]=60.3;
1178    vertices[23]=5;
1179    normals[21]=-3.829;
1180    normals[22]=1;
1181    normals[23]=5;
1182 
1183   indices[0]=0;
1184   indices[1]=4;
1185   indices[2]=5;
1186   indices[3]=1;
1187 
1188   indices[4]=1;
1189   indices[5]=5;
1190   indices[6]=6;
1191   indices[7]=2;
1192 
1193   indices[8]=2;
1194   indices[9]=6;
1195   indices[10]=7;
1196   indices[11]=3;
1197 
1198   indices[12]=0;
1199   indices[13]=3;
1200   indices[14]=7;
1201   indices[15]=4;
1202 
1203   indices[16]=0;
1204   indices[17]=1;
1205   indices[18]=2;
1206   indices[19]=3;
1207 
1208   indices[20]=4;
1209   indices[21]=7;
1210   indices[22]=6;
1211   indices[23]=5;
1212   }
1213 
1214   // Banden in y-Richtung berechnen
1215   // f�r Multiply dann 1 oder -1 setzen!!
1216 
1217   else {
1218 
1219   vertices[0]=-123.8*Multiply;       // Punkt 0
1220   vertices[1]=68.5;
1221   vertices[2]=0;
1222   normals[0]=-1;
1223   normals[1]=-3.429;
1224   normals[2]=-5;
1225 
1226   vertices[3]=-117.16*Multiply;       // Punkt 1
1227   vertices[4]=63.5;
1228   vertices[5]=3.429;
1229   normals[3]=-1;
1230   normals[4]=-3.429;
1231   normals[5]=-5;
1232 
1233   vertices[6]=-117.16*Multiply;        // Punkt 2
1234   vertices[7]=63.5;
1235   vertices[8]=3.829;
1236   normals[6]=-1;
1237   normals[7]=-1.371;
1238   normals[8]=5;
1239 
1240   vertices[9]=-123.8*Multiply;        // Punkt 3
1241   vertices[10]=68.5;
1242   vertices[11]=5;
1243   normals[9]=-1;
1244   normals[10]=3.829;
1245   normals[11]=5;
1246 
1247   vertices[12]=-6.5*Multiply;       // Punkt 4
1248   vertices[13]=68.5;
1249   vertices[14]=0;
1250   normals[12]=1;
1251   normals[13]=-3.429;
1252   normals[14]=-5;
1253 
1254   vertices[15]=-7.38*Multiply;       // Punkt 5
1255   vertices[16]=63.5;
1256   vertices[17]=3.429;
1257   normals[15]=1;
1258   normals[16]=-3.429;
1259   normals[17]=-5;
1260 
1261   vertices[18]=-7.38*Multiply;       // Punkt 6
1262   vertices[19]=63.5;
1263   vertices[20]=3.829;
1264   normals[18]=1;
1265   normals[19]=-1.372;
1266   normals[20]=5;
1267 
1268   vertices[21]=-6.5*Multiply;       // Punkt 7
1269   vertices[22]=68.5;
1270   vertices[23]=5;
1271   normals[21]=1;
1272   normals[22]=3.829;
1273   normals[23]=5;
1274 
1275   if (Multiply == 1){
1276   indices[0]=0;
1277   indices[1]=4;
1278   indices[2]=5;
1279   indices[3]=1;
1280 
1281   indices[4]=1;
1282   indices[5]=5;
1283   indices[6]=6;
1284   indices[7]=2;
1285 
1286   indices[8]=2;
1287   indices[9]=6;
1288   indices[10]=7;
1289   indices[11]=3;
1290 
1291   indices[12]=0;
1292   indices[13]=3;
1293   indices[14]=7;
1294   indices[15]=4;
1295 
1296   indices[16]=0;
1297   indices[17]=1;
1298   indices[18]=2;
1299   indices[19]=3;
1300 
1301   indices[20]=4;
1302   indices[21]=7;
1303   indices[22]=6;
1304   indices[23]=5;
1305   }
1306 
1307   if (Multiply == -1) {
1308 
1309   indices[0]=4;
1310   indices[1]=0;
1311   indices[2]=1;
1312   indices[3]=5;
1313 
1314   indices[4]=5;
1315   indices[5]=1;
1316   indices[6]=2;
1317   indices[7]=6;
1318 
1319   indices[8]=6;
1320   indices[9]=2;
1321   indices[10]=3;
1322   indices[11]=7;
1323 
1324   indices[12]=4;
1325   indices[13]=7;
1326   indices[14]=3;
1327   indices[15]=0;
1328 
1329   indices[16]=4;
1330   indices[17]=5;
1331   indices[18]=6;
1332   indices[19]=7;
1333 
1334   indices[20]=1;
1335   indices[21]=0;
1336   indices[22]=3;
1337   indices[23]=2;
1338   }
1339   }
1340 
1341  glEnableClientState(GL_VERTEX_ARRAY);
1342  glEnableClientState(GL_NORMAL_ARRAY);
1343 
1344  glNormalPointer(GL_FLOAT, 0, normals);
1345  glVertexPointer(3, GL_FLOAT, 0, vertices);
1346 
1347  glDrawElements(GL_QUADS, 16+8 , GL_UNSIGNED_INT,indices);
1348 
1349  glDisableClientState(GL_VERTEX_ARRAY);
1350  glDisableClientState(GL_NORMAL_ARRAY);
1351 
1352  free(vertices);
1353  free(normals);
1354  free(indices);
1355 }
1356 
1357 
MittelLochRand()1358 void MittelLochRand() {
1359 
1360   GLfloat vertices[]={6.3,70.8,4.8,
1361 		      6.2,72.7,4.7,
1362 		      5.5,75,4.55,
1363 		      4.1,76.6,4.3,
1364 		      2.3,77.7,4.2,
1365 		      0,78,4.05,
1366 		      -2.3,77.7,4.1,
1367 		      -4.1,76.6,4.2,
1368 		      -5.5,75,4.55,
1369 		      -6.2,72.7,4.7,
1370 		      -6.3,70.8,4.8,
1371 		      6.3,70.8,5.2,
1372 		      6.2,72.7,5.1,
1373 		      5.5,75,4.95,
1374 		      4.1,76.6,4.7,
1375 		      2.3,77.7,4.5,
1376 		      0,78,4.45,
1377 		      -2.3,77.7,4.5,
1378 		      -4.1,76.6,4.6,
1379 		      -5.5,75,4.95,
1380 		      -6.2,72.7,5.1,
1381 		      -6.3,70.8,5.2,
1382 		      5.8,70.7,5.2,
1383 		      5.3,72.8,5.1,
1384 		      4.6,74.7,4.95,
1385 		      3.3,75.7,4.7,
1386 		      1.7,76.4,4.5,
1387 		      0,76.5,4.45,
1388 		      -1.7,76.4,4.5,
1389 		      -3.3,75.7,4.7,
1390 		      -4.6,74.7,4.95,
1391 		      -5.3,72.8,5.1,
1392 		      -5.8,70.7,5.2,
1393 		      5.8,70.7,4.8,
1394 		      5.3,72.8,4.7,
1395 		      4.6,74.7,4.55,
1396 		      3.3,75.7,4.3,
1397 		      1.7,76.4,4.1,
1398 		      0,76.5,4.05,
1399 		      -1.7,76.4,4.1,
1400 		      -3.3,75.7,4.3,
1401 		      -4.6,74.7,4.55,
1402 		      -5.3,72.8,4.7,
1403 		      -5.8,70.7,4.8};
1404 
1405 
1406   GLfloat normals[]={
1407                      1,.1,-3,
1408 		     1,0,-3,
1409 		     .8,.6,-3,
1410 		     .7,.7,-3,
1411 		     .4,.9,-3,
1412 		     0,1,-3,
1413 		     -.4,.9,-3,
1414 		     -.7,.7,-3,
1415 		     -.8,.6,-3,
1416 		     -1,0,-3,
1417 		     -1,.1,-3,
1418                      1,.1,3,
1419 		     1,0,3,
1420 		     .8,.6,3,
1421 		     .7,.7,3,
1422 		     .4,.9,3,
1423 		     0,1,3,
1424 		     -.4,.9,3,
1425 		     -.7,.7,3,
1426 		     -.8,.6,3,
1427 		     -1,0,3,
1428 		     -1,.1,3,
1429                      -1,-.1,3,
1430 		     -1,0,3,
1431 		     -.8,-.6,3,
1432 		     -.7,-.7,3,
1433 		     -.4,-.9,3,
1434 		     0,-1,3,
1435 		     .4,-.9,3,
1436 		     .7,-.7,3,
1437 		     .8,-.6,3,
1438 		     1,0,3,
1439 		     1,-.1,3,
1440                      -1,-.1,-3,
1441 		     -1,0,-3,
1442 		     -.8,-.6,-3,
1443 		     -.7,-.7,-3,
1444 		     -.4,-.9,-3,
1445 		     0,-1,-3,
1446 		     .4,-.9,-3,
1447 		     .7,-.7,-3,
1448 		     .8,-.6,-3,
1449 		     1,0,-3,
1450 		     1,-.1,-3};
1451 
1452   GLint indices[]={0,1,12,11,
1453 		   1,2,13,12,
1454 		   2,3,14,13,
1455 		   3,4,15,14,
1456 		   4,5,16,15,
1457 		   5,6,17,16,
1458 		   6,7,18,17,
1459 		   7,8,19,18,
1460 		   8,9,20,19,
1461 		   9,10,21,20,
1462 
1463 		   11,12,23,22,
1464 		   12,13,24,23,
1465 		   13,14,25,24,
1466 		   14,15,26,25,
1467 		   15,16,27,26,
1468 		   16,17,28,27,
1469 		   17,18,29,28,
1470 		   18,19,30,29,
1471 		   19,20,31,30,
1472 		   20,21,32,31,
1473 
1474 		   22,23,34,33,
1475 		   23,24,35,34,
1476 		   24,25,36,35,
1477 		   25,26,37,36,
1478 		   26,27,38,37,
1479 		   27,28,39,38,
1480 		   28,29,40,39,
1481 		   29,30,41,40,
1482 		   30,31,42,41,
1483 		   31,32,43,42,
1484 		   0,11,22,33,
1485 		   10,43,32,21};
1486 
1487   GLfloat mat_ambient[]={.1,.1,.1,1.0};
1488   GLfloat mat_diffuse[]={.3,.3,.3,1};
1489   GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
1490   GLfloat mat_shininess = 127.0;
1491 
1492   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_ambient);
1493   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
1494   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
1495   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
1496 
1497 
1498   glEnableClientState(GL_VERTEX_ARRAY);
1499   glEnableClientState(GL_NORMAL_ARRAY);
1500 
1501   glVertexPointer(3, GL_FLOAT, 0, vertices);
1502   glNormalPointer(GL_FLOAT, 0, normals);
1503 
1504   glDrawElements(GL_QUADS,4*32, GL_UNSIGNED_INT,indices);
1505 
1506   glDisableClientState(GL_VERTEX_ARRAY);
1507   glDisableClientState(GL_NORMAL_ARRAY);
1508 
1509 }
1510 
EckLochRand()1511 void EckLochRand() {
1512 
1513   GLfloat vertices[]={2.5,-5.9,4.8,
1514 		      5,-3.5,4.7,
1515 		      6.1,0,4.7,
1516 		      5.8,2.3,4.7,
1517 		      4.4,4.4,4.7,
1518 		      2.3,5.8,4.7,
1519 		      0,6.1,4.7,
1520 		      -3.5,5,4.7,
1521 		      -5.9,2.5,4.8,
1522 
1523 		      2.5,-5.9,5.2,
1524 		      5,-3.5,5.1,
1525 		      6.1,0,5.1,
1526 		      5.8,2.3,5.1,
1527 		      4.4,4.4,5.1,
1528 		      2.3,5.8,5.1,
1529 		      0,6.1,5.1,
1530 		      -3.5,5,5.1,
1531 		      -5.9,2.5,5.2,
1532 
1533 		      2.1,-5.5,5.2,
1534 		      4.4,-3.1,5.1,
1535 		      5,0,5.1,
1536 		      4.4,1.8,5.1,
1537 		      3.3,3.3,5.1,
1538 		      1.8,4.4,5.1,
1539 		      0,5,5.1,
1540 		      -3.1,4.4,5.1,
1541 		      -5.5,2.1,5.2,
1542 
1543 		      2.1,-5.5,4.8,
1544 		      4.4,-3.1,4.7,
1545 		      5,0,4.7,
1546 		      4.4,1.8,4.7,
1547 		      3.3,3.3,4.7,
1548 		      1.8,4.4,4.7,
1549 		      0,5,4.7,
1550 		      -3.1,4.4,4.7,
1551 		      -5.5,2.1,4.8};
1552 
1553 
1554   GLfloat normals[]={.7,-.7,-3,
1555 		     .8,-.5,-3,
1556 		     1,0,-3,
1557 		     .9,.4,-3,
1558 		     .7,.7,-3,
1559 		     .9,.4,-3,
1560 		     1,0,-3,
1561 		     .8,-.5,-3,
1562 		     .7,-.7,-3,
1563 
1564 		     .7,-.7,3,
1565 		     .8,-.5,3,
1566 		     1,0,3,
1567 		     .9,.4,3,
1568 		     .7,.7,3,
1569 		     .9,.4,3,
1570 		     1,0,3,
1571 		     .8,-.5,3,
1572 		     .7,-.7,3,
1573 
1574 		     -.7,.7,3,
1575 		     -.8,.5,3,
1576 		     -1,0,3,
1577 		     -.9,-.4,3,
1578 		     -.7,-.7,3,
1579 		     -.9,-.4,3,
1580 		     -1,0,3,
1581 		     -.8,.5,3,
1582 		     -.7,.7,3,
1583 
1584 		     -.7,.7,-3,
1585 		     -.8,.5,-3,
1586 		     -1,0,-3,
1587 		     -.9,-.4,-3,
1588 		     -.7,-.7,-3,
1589 		     -.9,-.4,-3,
1590 		     -1,0,-3,
1591 		     -.8,.5,-3,
1592 		     -.7,.7,-3};
1593 
1594   GLint indices[]={0,1,10,9,
1595 		   1,2,11,10,
1596 		   2,3,12,11,
1597 		   3,4,13,12,
1598 		   4,5,14,13,
1599 		   5,6,15,14,
1600 		   6,7,16,15,
1601 		   7,8,17,16,
1602 
1603 		   9,10,19,18,
1604 		   10,11,20,19,
1605 		   11,12,21,20,
1606 		   12,13,22,21,
1607 		   13,14,23,22,
1608 		   14,15,24,23,
1609 		   15,16,25,24,
1610 		   16,17,26,25,
1611 
1612 		   18,19,28,27,
1613 		   19,20,29,28,
1614 		   20,21,30,29,
1615 		   21,22,31,30,
1616 		   22,23,32,31,
1617 		   23,24,33,32,
1618 		   24,25,34,33,
1619 		   25,26,35,34,
1620 
1621 		   0,9,18,27,
1622 		   35,26,17,8};
1623 
1624 
1625 
1626   GLfloat mat_ambient[]={.1,.1,.1,1.0};
1627   GLfloat mat_diffuse[]={.3,.3,.3,1};
1628   GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
1629   GLfloat mat_shininess = 127.0;
1630 
1631   glMaterialfv(GL_FRONT, GL_AMBIENT,mat_ambient);
1632   glMaterialfv(GL_FRONT, GL_DIFFUSE,mat_diffuse);
1633   glMaterialfv(GL_FRONT, GL_SPECULAR,mat_specular);
1634   glMaterialf(GL_FRONT, GL_SHININESS,mat_shininess);
1635 
1636 
1637   glEnableClientState(GL_VERTEX_ARRAY);
1638   glEnableClientState(GL_NORMAL_ARRAY);
1639 
1640   glVertexPointer(3, GL_FLOAT, 0, vertices);
1641   glNormalPointer(GL_FLOAT, 0, normals);
1642 
1643   glDrawElements(GL_QUADS,4*26, GL_UNSIGNED_INT,indices);
1644 
1645   glDisableClientState(GL_VERTEX_ARRAY);
1646   glDisableClientState(GL_NORMAL_ARRAY);
1647 
1648 }
1649 
Diamant(GLfloat x,GLfloat y,GLfloat z)1650 void Diamant(GLfloat x, GLfloat y, GLfloat z) {
1651   glBegin(GL_QUADS);
1652   glNormal3f(0,0,1);
1653   glVertex3f(x+0.0,y+0.5,z);
1654   glVertex3f(x-0.5,y+0.0,z);
1655   glVertex3f(x+0.0,y-0.5,z);
1656   glVertex3f(x+0.5,y+0.0,z);
1657   glNormal3f(-0.235,0.235,0.94);
1658   glVertex3f(x+0.0,y+0.5,z-0.0);
1659   glVertex3f(x+0.0,y+1.5,z-0.3);
1660   glVertex3f(x-1.5,y+0.0,z-0.3);
1661   glVertex3f(x-0.5,y+0.0,z-0.0);
1662   glNormal3f(-0.235,-0.235,0.94);
1663   glVertex3f(x-0.5,y+0.0,z-0.0);
1664   glVertex3f(x-1.5,y+0.0,z-0.3);
1665   glVertex3f(x-0.0,y-1.5,z-0.3);
1666   glVertex3f(x-0.0,y-0.5,z-0.0);
1667   glNormal3f(0.235,-0.235,0.94);
1668   glVertex3f(x+0.0,y-0.5,z-0.0);
1669   glVertex3f(x+0.0,y-1.5,z-0.3);
1670   glVertex3f(x+1.5,y+0.0,z-0.3);
1671   glVertex3f(x+0.5,y+0.0,z-0.0);
1672   glNormal3f(0.235,0.235,0.94);
1673   glVertex3f(x+0.5,y+0.0,z-0.0);
1674   glVertex3f(x+1.5,y+0.0,z-0.3);
1675   glVertex3f(x-0.0,y+1.5,z-0.3);
1676   glVertex3f(x-0.0,y+0.5,z-0.0);
1677   glEnd();
1678 
1679 }
1680