X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fmenger.c;h=e1364c44c0db7d83942e0796986e42ceac040a8c;hp=96ddaccd5e3c610e60f95e27c1c931b204462fc8;hb=cccbddbc4140cf9a06d7d95cc5c0ca36eb5d6e28;hpb=a94197e76a5dea5cb60542840809d6c20d0abbf3 diff --git a/hacks/glx/menger.c b/hacks/glx/menger.c index 96ddaccd..e1364c44 100644 --- a/hacks/glx/menger.c +++ b/hacks/glx/menger.c @@ -1,4 +1,4 @@ -/* menger, Copyright (c) 2001 Jamie Zawinski +/* menger, Copyright (c) 2001, 2002 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -189,25 +189,6 @@ reshape_sponge (ModeInfo *mi, int width, int height) } -static void -gl_init (ModeInfo *mi) -{ -/* sponge_configuration *sp = &sps[MI_SCREEN(mi)]; */ - int wire = MI_IS_WIREFRAME(mi); - - static GLfloat pos[4] = {-4.0, 3.0, 10.0, 1.0}; - - if (!wire) - { - glLightfv(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - } -} - - /* lifted from lament.c */ #define RAND(n) ((long) ((random() & 0x7fffffff) % ((long) (n)))) #define RANDSIGN() ((random() & 1) ? 1 : -1) @@ -524,6 +505,7 @@ void init_sponge (ModeInfo *mi) { sponge_configuration *sp; + int wire = MI_IS_WIREFRAME(mi); if (!sps) { sps = (sponge_configuration *) @@ -539,10 +521,29 @@ init_sponge (ModeInfo *mi) sp = &sps[MI_SCREEN(mi)]; if ((sp->glx_context = init_GL(mi)) != NULL) { - gl_init(mi); reshape_sponge (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); } + if (!wire) + { + static GLfloat pos0[4] = {-1.0, -1.0, 1.0, 0.1}; + static GLfloat pos1[4] = { 1.0, -0.2, 0.2, 0.1}; + static GLfloat dif0[4] = {1.0, 1.0, 1.0, 1.0}; + static GLfloat dif1[4] = {1.0, 1.0, 1.0, 1.0}; + + glLightfv(GL_LIGHT0, GL_POSITION, pos0); + glLightfv(GL_LIGHT1, GL_POSITION, pos1); + glLightfv(GL_LIGHT0, GL_DIFFUSE, dif0); + glLightfv(GL_LIGHT1, GL_DIFFUSE, dif1); + + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_LIGHT1); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + } + sp->rotx = frand(1.0) * RANDSIGN(); sp->roty = frand(1.0) * RANDSIGN(); sp->rotz = frand(1.0) * RANDSIGN();