1 /* -*- Mode: C; tab-width: 4 -*- */
2 /* sproingies.c - 3D sproingies */
5 static const char sccsid[] = "@(#)sproingies.c 4.04 97/07/28 xlockmore";
9 * sproingies.c - Copyright 1996 by Ed Mackey, freely distributable.
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose and without fee is hereby granted,
13 * provided that the above copyright notice appear in all copies and that
14 * both that copyright notice and this permission notice appear in
15 * supporting documentation.
17 * This file is provided AS IS with no warranties of any kind. The author
18 * shall have no liability with respect to the infringement of copyrights,
19 * trade secrets or any patents by this file or any part thereof. In no
20 * event will the author be liable for any lost revenue or profits or
21 * other special, indirect and consequential damages.
29 #endif /* HAVE_CONFIG_H */
32 # include "xlockmoreI.h" /* from the xscreensaver distribution */
33 #else /* !STANDALONE */
34 # include "xlock.h" /* from the xlockmore distribution */
35 #endif /* !STANDALONE */
40 # include <OpenGL/glu.h>
46 #include "sproingies.h"
48 #define MAXSPROING 100
49 #define TARGET_COUNT 40
51 #define NO_FRAME (-10)
52 #define RESET_SPROINGIE_LIFE (-30 + myrand(28))
53 #define NEW_SPROINGIE_LIFE (40 + myrand(200))
60 * The sproingies have six "real" frames, (s1_1 to s1_6) that show a
61 * sproingie jumping off a block, headed down and to the right.
62 * The frames are numbered from 0 (FIRST_FRAME) to 5 (LAST_FRAME).
64 * There are other frame numbers for special cases (e.g. BOOM_FRAME).
66 struct sPosColor { /* Position and color of the sproingie */
67 int x, y, z; /* Position */
68 int frame; /* Current frame (0-5) */
69 int life; /* Life points */
70 GLfloat r, g, b; /* Color RGB */
71 int direction; /* Direction of next hop (left or right) */
75 int rotx, roty, dist, wireframe, flatshade, groundlevel,
77 int sframe, target_rx, target_ry, target_dist, target_count;
78 const struct gllist *sproingies[6];
79 const struct gllist *SproingieBoom;
81 struct sPosColor *positions;
84 static sp_instance *si_list = NULL;
85 static int active_screens = 0;
87 extern const struct gllist *s1_1;
88 extern const struct gllist *s1_2;
89 extern const struct gllist *s1_3;
90 extern const struct gllist *s1_4;
91 extern const struct gllist *s1_5;
92 extern const struct gllist *s1_6;
93 extern const struct gllist *s1_b;
98 return ((int) (((float) range) * LRAND() / (MAXRAND)));
101 static int smart_sproingies = 0;
104 build_TopsSides(int wireframe)
107 GLfloat mat_color[4] =
108 {0.0, 0.0, 0.0, 1.0};
110 dl_num = glGenLists(2);
112 return (0); /* 0 means out of display lists. */
115 glNewList(dl_num, GL_COMPILE);
116 mat_color[0] = 0.392157;
117 mat_color[1] = 0.784314;
118 mat_color[2] = 0.941176;
120 glColor3fv(mat_color);
122 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_color);
127 glNewList(dl_num + 1, GL_COMPILE);
129 glColor3fv(mat_color);
131 /* jwz: in wireframe mode, color tops and sides the same. */
132 mat_color[0] = 0.156863;
133 mat_color[1] = 0.156863;
134 mat_color[2] = 0.392157;
135 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_color);
142 LayGround(int sx, int sy, int sz, int width, int height, sp_instance * si)
145 GLenum begin_polygon;
148 begin_polygon = GL_LINE_LOOP;
150 begin_polygon = GL_POLYGON;
152 if (!si->wireframe) {
154 glCallList(si->TopsSides); /* Render the tops */
155 glNormal3f(0.0, 1.0, 0.0);
157 for (h = 0; h < height; ++h) {
161 for (w = 0; w < width; ++w) {
162 glBegin(begin_polygon);
164 glVertex3i(x, y, z - 1);
165 glVertex3i(x + 1, y, z - 1);
166 glVertex3i(x + 1, y, z);
168 glBegin(begin_polygon);
169 glVertex3i(x + 1, y - 1, z);
170 glVertex3i(x + 1, y - 1, z - 1);
171 glVertex3i(x + 2, y - 1, z - 1);
172 glVertex3i(x + 2, y - 1, z);
180 glCallList(si->TopsSides + 1); /* Render the sides */
182 glNormal3f(0.0, 0.0, 1.0);
184 for (h = 0; h < height; ++h) {
188 for (w = 0; w < width; ++w) {
189 glBegin(begin_polygon);
191 glVertex3i(x + 1, y, z);
192 glVertex3i(x + 1, y - 1, z);
193 glVertex3i(x, y - 1, z);
195 glBegin(begin_polygon);
196 glVertex3i(x + 1, y - 1, z);
197 glVertex3i(x + 2, y - 1, z);
198 glVertex3i(x + 2, y - 2, z);
199 glVertex3i(x + 1, y - 2, z);
201 * PURIFY 4.0.1 reports an unitialized memory read on the next line when using
202 * MesaGL 2.2 and -mono. This has been fixed in MesaGL 2.3 and later. */
209 /* Render the other sides */
211 glNormal3f(1.0, 0.0, 0.0);
213 for (h = 0; h < height; ++h) {
217 for (w = 0; w < width; ++w) {
218 glBegin(begin_polygon);
219 glVertex3i(x + 1, y, z);
220 glVertex3i(x + 1, y, z - 1);
221 glVertex3i(x + 1, y - 1, z - 1);
222 glVertex3i(x + 1, y - 1, z);
224 glBegin(begin_polygon);
225 glVertex3i(x + 2, y - 1, z);
226 glVertex3i(x + 2, y - 1, z - 1);
227 glVertex3i(x + 2, y - 2, z - 1);
228 glVertex3i(x + 2, y - 2, z);
237 glCallList(si->TopsSides); /* Render the tops */
239 for (h = 0; h < height; ++h) {
243 for (w = 0; w < width; ++w) {
244 glBegin(begin_polygon);
246 glVertex3i(x, y, z - 1);
247 glVertex3i(x + 1, y, z - 1);
248 glVertex3i(x + 1, y, z);
250 glBegin(begin_polygon);
251 glVertex3i(x + 1, y - 1, z);
252 glVertex3i(x + 1, y - 1, z - 1);
253 glVertex3i(x + 2, y - 1, z - 1);
254 glVertex3i(x + 2, y - 1, z);
264 AdvanceSproingie(int t, sp_instance * si)
266 int g_higher, g_back, t2;
267 struct sPosColor *thisSproingie = &(si->positions[t]);
268 struct sPosColor *S2 = &(si->positions[0]);
270 if (thisSproingie->life > 0) {
271 if ((++(thisSproingie->frame)) > LAST_FRAME) {
272 if (thisSproingie->frame >= BOOM_FRAME) {
273 if ((thisSproingie->r -= 0.08) < 0.0)
274 thisSproingie->r = 0.0;
275 if ((thisSproingie->g -= 0.08) < 0.0)
276 thisSproingie->g = 0.0;
277 if ((thisSproingie->b -= 0.08) < 0.0)
278 thisSproingie->b = 0.0;
279 if ((--(thisSproingie->life)) < 1) {
280 thisSproingie->life = RESET_SPROINGIE_LIFE;
284 thisSproingie->frame = FIRST_FRAME;
286 /* Check for collisions */
287 for (t2 = 0; t2 < si->maxsproingies; ++t2) {
288 if ((t2 != t) && (thisSproingie->x == S2->x) &&
289 (thisSproingie->y == S2->y) && (thisSproingie->z == S2->z) &&
290 (S2->life > 10) && (S2->frame < LAST_FRAME + 1)) {
292 if (thisSproingie->life > S2->life) {
296 if (thisSproingie->life > 10) {
297 thisSproingie->life = 10;
298 thisSproingie->frame = BOOM_FRAME;
299 if ((thisSproingie->r += 0.5) > 1.0)
300 thisSproingie->r = 1.0;
301 if ((thisSproingie->g += 0.5) > 1.0)
302 thisSproingie->g = 1.0;
303 if ((thisSproingie->b += 0.5) > 1.0)
304 thisSproingie->b = 1.0;
313 /* Time to disappear... */
314 if (!((thisSproingie->life == 10) &&
315 (thisSproingie->frame > FIRST_FRAME) &&
316 (thisSproingie->frame < BOOM_FRAME))) {
317 if ((--(thisSproingie->life)) < 1) {
318 thisSproingie->life = RESET_SPROINGIE_LIFE;
319 } else if (thisSproingie->life < 9) {
320 thisSproingie->frame -= 2;
322 } /* ... else wait here for frame FIRST_FRAME to come about. */
323 } else if (++(thisSproingie->life) >= 0) {
325 g_higher = -3 + myrand(5);
326 g_back = -2 + myrand(5);
328 g_higher = -2 + myrand(3);
329 g_back = -1 + myrand(3);
335 thisSproingie->x = (-g_higher - g_back);
336 thisSproingie->y = (g_higher << 1);
337 thisSproingie->z = (g_back - g_higher);
338 thisSproingie->life = NEW_SPROINGIE_LIFE;
339 thisSproingie->frame = NO_FRAME;
340 thisSproingie->r = (GLfloat) (40 + myrand(200)) / 255.0;
341 thisSproingie->g = (GLfloat) (40 + myrand(200)) / 255.0;
342 thisSproingie->b = (GLfloat) (40 + myrand(200)) / 255.0;
344 for (t2 = 0; t2 < si->maxsproingies; ++t2) {
345 if ((t2 != t) && (thisSproingie->x == S2->x) &&
346 (thisSproingie->y == S2->y) && (thisSproingie->z == S2->z) &&
347 (S2->life > 10) && (S2->frame < FIRST_FRAME)) {
348 /* If another is already on this place, wait. */
349 thisSproingie->life = -1;
357 NextSproingie(int screen)
359 sp_instance *si = &si_list[screen];
361 struct sPosColor *thisSproingie = &(si->positions[0]);
363 /* Although the sproingies cycle has six frames, the blocks cycle */
364 /* has twelve. After a full cycle (12 frames), re-center positions */
366 if (++si->sframe > 11) {
367 si->sframe = FIRST_FRAME;
368 for (t = 0; t < si->maxsproingies; ++t) {
369 thisSproingie->x -= 1;
370 thisSproingie->y += 2;
371 thisSproingie->z -= 1;
376 for (t = 0; t < si->maxsproingies; ++t) {
377 AdvanceSproingie(t, si);
380 if (si->target_count < 0) { /* track to current target */
381 if (si->target_rx < si->rotx)
383 else if (si->target_rx > si->rotx)
386 if (si->target_ry < si->roty)
388 else if (si->target_ry > si->roty)
391 ddx = (si->target_dist - si->dist) / 8;
394 else if (si->target_dist < si->dist)
396 else if (si->target_dist > si->dist)
399 if ((si->target_rx == si->rotx) && (si->target_ry == si->roty) &&
400 (si->target_dist == si->dist)) {
401 si->target_count = TARGET_COUNT;
402 if (si->target_dist <= 32)
403 si->target_count >>= 2;
405 } else if (--si->target_count < 0) { /* make up new target */
406 si->target_rx = myrand(100) - 35;
407 si->target_ry = -myrand(90);
408 si->target_dist = 32 << myrand(2); /* could be 32, 64, or 128, (previously or 256) */
410 if (si->target_dist >= si->dist) /* no duplicate distances */
411 si->target_dist <<= 1;
413 /* Otherwise just hang loose for a while here */
422 for (t = 0; t < maxsproingies; ++t) {
423 if (positions[t].life > 0)
426 (void) printf("RotX: %d, RotY: %d, Dist: %d. Targets: X %d, Y %d, D %d. Visible: %d\n",
427 rotx, roty, dist, target_rx, target_ry, target_dist, count);
435 for (t = 0; t < maxsproingies; ++t) {
439 positions[t].life = -2;
440 positions[t].frame = FIRST_FRAME;
447 if (dist < (1 << 16 << 4))
461 rotx = (rotx + 5) % 360;
467 rotx = (rotx - 5) % 360;
473 roty = (roty + 5) % 360;
479 roty = (roty - 5) % 360;
485 rotx = (rotx + 45) % 360;
491 rotx = (rotx - 45) % 360;
497 roty = (roty + 45) % 360;
503 roty = (roty - 45) % 360;
506 #endif /* __AUXFUNCS__ */
509 RenderSproingie(int t, sp_instance * si)
511 GLfloat scale, pointsize, mat_color[4] =
512 {0.0, 0.0, 0.0, 1.0};
513 GLdouble clipplane[4] =
514 {0.0, 1.0, 0.0, 0.0};
515 struct sPosColor *thisSproingie = &(si->positions[t]);
517 if (thisSproingie->life < 1)
523 mat_color[0] = thisSproingie->r;
524 mat_color[1] = thisSproingie->g;
525 mat_color[2] = thisSproingie->b;
527 glColor3fv(mat_color);
529 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_color);
533 if (thisSproingie->frame < FIRST_FRAME) {
534 glEnable(GL_CLIP_PLANE0);
535 glTranslatef((GLfloat) (thisSproingie->x),
536 (GLfloat) (thisSproingie->y) +
537 ((GLfloat) (thisSproingie->frame) / 9.0),
538 (GLfloat) (thisSproingie->z));
539 clipplane[3] = ((GLdouble) (thisSproingie->frame) / 9.0) +
540 (si->wireframe ? 0.0 : 0.1);
541 glClipPlane(GL_CLIP_PLANE0, clipplane);
542 /** glCallList(si->sproingies[0]);*/
543 /**/ renderList(si->sproingies[0], si->wireframe);
544 glDisable(GL_CLIP_PLANE0);
545 } else if (thisSproingie->frame >= BOOM_FRAME) {
546 glTranslatef((GLfloat) (thisSproingie->x) + 0.5,
547 (GLfloat) (thisSproingie->y) + 0.5,
548 (GLfloat) (thisSproingie->z) - 0.5);
549 scale = (GLfloat) (1 << (thisSproingie->frame - BOOM_FRAME));
550 glScalef(scale, scale, scale);
551 if (!si->wireframe) {
553 glColor3fv(mat_color);
554 glDisable(GL_LIGHTING);
556 pointsize = (GLfloat) ((BOOM_FRAME + 8) - thisSproingie->frame) -
558 glPointSize((pointsize < 1.0) ? 1.0 : pointsize);
560 * PURIFY 4.0.1 reports an unitialized memory read on the next line when using
561 * MesaGL 2.2. This has been tracked to MesaGL 2.2 src/points.c line 313. */
562 /** glCallList(si->SproingieBoom);*/
563 /**/ renderList(si->SproingieBoom, si->wireframe);
565 if (!si->wireframe) {
566 glEnable(GL_LIGHTING);
569 if (thisSproingie->direction == JUMP_LEFT) {
570 /* When the sproingie jumps to the left, the frames must be */
571 /* rotated and translated */
572 glTranslatef((GLfloat) (thisSproingie->x ),
573 (GLfloat) (thisSproingie->y ),
574 (GLfloat) (thisSproingie->z - 1));
575 glRotatef((GLfloat) - 90.0, 0.0, 1.0, 0.0);
576 if (thisSproingie->frame == LAST_FRAME) {
577 thisSproingie->x -= 0;
578 thisSproingie->y -= 1;
579 thisSproingie->z += 1;
582 glTranslatef((GLfloat) (thisSproingie->x),
583 (GLfloat) (thisSproingie->y),
584 (GLfloat) (thisSproingie->z));
585 glRotatef((GLfloat) - 0.0, 0.0, 1.0, 0.0);
586 if (thisSproingie->frame == LAST_FRAME) {
587 thisSproingie->x += 1;
588 thisSproingie->y -= 1;
589 thisSproingie->z -= 0;
593 /** glCallList(si->sproingies[thisSproingie->frame]);*/
594 /**/ renderList(si->sproingies[thisSproingie->frame], si->wireframe);
596 /* Every 6 frame cycle... */
597 if (thisSproingie->frame == LAST_FRAME) {
598 /* ...check if the sproingies have gone out of the bricks */
599 if (((thisSproingie->x - thisSproingie->z == 6) &&
600 (2*thisSproingie->x + thisSproingie->y == 6)) ||
601 ((thisSproingie->z - thisSproingie->x == 5) &&
602 (2*thisSproingie->x + thisSproingie->y == -5))) {
603 /* If they have, then they die */
604 if (thisSproingie->life > 0 && thisSproingie->frame < BOOM_FRAME && thisSproingie->frame > FIRST_FRAME) {
605 thisSproingie->frame = BOOM_FRAME;
608 /* If not, they choose a direction for the next hop */
609 if (smart_sproingies) {
610 if ((thisSproingie->x - thisSproingie->z == 5) &&
611 (2*thisSproingie->x + thisSproingie->y == 5)) {
612 thisSproingie->direction = JUMP_LEFT;
613 } else if ((thisSproingie->z - thisSproingie->x == 4) &&
614 (2*thisSproingie->x + thisSproingie->y == -4)) {
615 thisSproingie->direction = JUMP_RIGHT;
617 thisSproingie->direction = myrand(2);
620 thisSproingie->direction = myrand(2);
631 ComputeGround(sp_instance * si)
633 int g_higher, g_back, g_width, g_height;
635 /* higher: x-1, y+2, z-1 */
636 /* back: x-1, y, z+1 */
638 if (si->groundlevel == 0) {
641 } else if (si->groundlevel == 1) {
649 if ((g_higher = si->dist >> 3) < 4)
653 g_height = g_higher << 1;
656 g_higher += (g_higher >> 2);
657 else if (si->rotx > 10)
658 g_higher -= (g_higher >> 2);
661 if (si->dist > 128) {
665 } else if (si->dist > 64) {
668 } else if (si->dist > 32) {
669 /* nothing special */
672 g_higher = g_back = 4;
677 /* startx, starty, startz, width, height */
678 LayGround((-g_higher - g_back), (g_higher << 1), (g_back - g_higher),
679 (g_width), (g_height), si);
683 DisplaySproingies(int screen,int pause)
685 sp_instance *si = &si_list[screen];
688 {8.0, 5.0, -2.0, 0.1};
691 glClear(GL_COLOR_BUFFER_BIT);
693 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
696 glTranslatef(0.0, 0.0, -(GLfloat) (si->dist) / 16.0); /* viewing transform */
697 glRotatef((GLfloat) si->rotx, 1.0, 0.0, 0.0);
698 glRotatef((GLfloat) si->roty, 0.0, 1.0, 0.0);
701 glLightfv(GL_LIGHT0, GL_POSITION, position);
703 #if 0 /* Show light pos */
705 glTranslatef(position[0], position[1], position[2]);
706 glColor3f(1.0, 1.0, 1.0);
707 if (!si->wireframe) {
708 glDisable(GL_LIGHTING);
710 glCallList(si->SproingieBoom);
711 if (!si->wireframe) {
712 glEnable(GL_LIGHTING);
717 glTranslatef((GLfloat) si->sframe * (-1.0 / 12.0) - 0.75,
718 (GLfloat) si->sframe * (2.0 / 12.0) - 0.5,
719 (GLfloat) si->sframe * (-1.0 / 12.0) + 0.75);
724 for (t = 0; t < si->maxsproingies; ++t) {
725 RenderSproingie(t, si);
736 NextSproingieDisplay(int screen,int pause)
738 NextSproingie(screen);
739 /* if (pause) usleep(pause); don't do this! -jwz */
740 DisplaySproingies(screen,pause);
744 ReshapeSproingies(int w, int h)
746 glViewport(0, 0, w, h);
747 glMatrixMode(GL_PROJECTION);
749 gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 0.1, 2000.0); /* was 200000.0 */
750 glMatrixMode(GL_MODELVIEW);
755 CleanupSproingies(int screen)
757 sp_instance *si = &si_list[screen];
760 if (si->SproingieBoom) {
761 for (t = 0; t < 6; ++t)
762 glDeleteLists(si->sproingies[t], 1);
764 glDeleteLists(si->TopsSides, 2);
765 glDeleteLists(si->SproingieBoom, 1);
768 si->SproingieBoom = 0;
772 glDeleteLists(si->TopsSides, 2);
775 (void) free((void *) (si->positions));
776 si->positions = NULL;
778 if ((active_screens == 0) && si_list) {
779 (void) free((void *) (si_list));
785 InitSproingies(int wfmode, int grnd, int mspr, int smrtspr,
786 int screen, int numscreens, int mono)
789 {0.2, 0.2, 0.2, 1.0};
791 {10.0, 1.0, 1.0, 10.0};
792 GLfloat mat_diffuse[] =
793 {0.6, 0.6, 0.6, 1.0};
794 GLfloat mat_specular[] =
795 {0.8, 0.8, 0.8, 1.0};
796 GLfloat mat_shininess[] =
802 if (si_list == NULL) {
803 if ((si_list = (sp_instance *) calloc(numscreens,
804 sizeof (sp_instance))) == NULL)
807 si = &si_list[screen];
810 CleanupSproingies(screen);
814 if (mspr >= MAXSPROING)
815 mspr = MAXSPROING - 1;
817 smart_sproingies = smrtspr;
821 si->dist = (16 << 2);
823 si->target_count = 0;
826 si->wireframe = si->flatshade = 0;
833 si->groundlevel = grnd;
834 si->maxsproingies = mspr;
836 if (si->maxsproingies) {
837 si->positions = (struct sPosColor *) calloc(si->maxsproingies,
838 sizeof (struct sPosColor));
840 if (!(si->positions))
841 si->maxsproingies = 0;
843 for (t = 0; t < si->maxsproingies; ++t) {
844 si->positions[t].x = 0;
845 si->positions[t].y = 0;
846 si->positions[t].z = 0;
847 si->positions[t].life = (-t * ((si->maxsproingies > 19) ? 1 : 4)) - 2;
848 si->positions[t].frame = FIRST_FRAME;
849 si->positions[t].direction = myrand(2);
852 #if 0 /* Test boom */
853 si->positions[0].x = 0;
854 si->positions[0].y = 0;
855 si->positions[0].z = 0;
856 si->positions[0].life = 10;
857 si->positions[0].frame = BOOM_FRAME;
858 si->positions[0].r = 0.656863;
859 si->positions[0].g = 1.0;
860 si->positions[0].b = 0.656863;
863 if (!(si->TopsSides = build_TopsSides(si->wireframe)))
864 (void) fprintf(stderr, "build_TopsSides\n");
866 if (!(si->sproingies[0] = BuildLWO(si->wireframe, &LWO_s1_1)))
867 (void) fprintf(stderr, "BuildLWO - 1\n");
868 if (!(si->sproingies[1] = BuildLWO(si->wireframe, &LWO_s1_2)))
869 (void) fprintf(stderr, "BuildLWO - 2\n");
870 if (!(si->sproingies[2] = BuildLWO(si->wireframe, &LWO_s1_3)))
871 (void) fprintf(stderr, "BuildLWO - 3\n");
872 if (!(si->sproingies[3] = BuildLWO(si->wireframe, &LWO_s1_4)))
873 (void) fprintf(stderr, "BuildLWO - 4\n");
874 if (!(si->sproingies[4] = BuildLWO(si->wireframe, &LWO_s1_5)))
875 (void) fprintf(stderr, "BuildLWO - 5\n");
876 if (!(si->sproingies[5] = BuildLWO(si->wireframe, &LWO_s1_6)))
877 (void) fprintf(stderr, "BuildLWO - 6\n");
879 if (!(si->SproingieBoom = BuildLWO(si->wireframe, &LWO_s1_b)))
880 (void) fprintf(stderr, "BuildLWO - b\n");
882 si->sproingies[0]=s1_1;
883 si->sproingies[1]=s1_2;
884 si->sproingies[2]=s1_3;
885 si->sproingies[3]=s1_4;
886 si->sproingies[4]=s1_5;
887 si->sproingies[5]=s1_6;
888 si->SproingieBoom=s1_b;
891 glShadeModel(GL_FLAT);
892 glDisable(GL_LIGHTING);
895 glShadeModel(GL_FLAT);
899 glEnable(GL_LIGHTING);
901 glDepthFunc(GL_LEQUAL);
902 glEnable(GL_DEPTH_TEST);
904 glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
905 glLightfv(GL_LIGHT0, GL_POSITION, position);
907 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
908 glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
909 glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
911 /* glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); */
913 glEnable(GL_CULL_FACE);
916 /* glEnable(GL_NORMALIZE); */
922 /* End of sproingies.c */