head 1.10; access; symbols pkgsrc-2016Q3:1.9.0.108 pkgsrc-2016Q3-base:1.9 pkgsrc-2016Q2:1.9.0.106 pkgsrc-2016Q2-base:1.9 pkgsrc-2016Q1:1.9.0.104 pkgsrc-2016Q1-base:1.9 pkgsrc-2015Q4:1.9.0.102 pkgsrc-2015Q4-base:1.9 pkgsrc-2015Q3:1.9.0.100 pkgsrc-2015Q3-base:1.9 pkgsrc-2015Q2:1.9.0.98 pkgsrc-2015Q2-base:1.9 pkgsrc-2015Q1:1.9.0.96 pkgsrc-2015Q1-base:1.9 pkgsrc-2014Q4:1.9.0.94 pkgsrc-2014Q4-base:1.9 pkgsrc-2014Q3:1.9.0.92 pkgsrc-2014Q3-base:1.9 pkgsrc-2014Q2:1.9.0.90 pkgsrc-2014Q2-base:1.9 pkgsrc-2014Q1:1.9.0.88 pkgsrc-2014Q1-base:1.9 pkgsrc-2013Q4:1.9.0.86 pkgsrc-2013Q4-base:1.9 pkgsrc-2013Q3:1.9.0.84 pkgsrc-2013Q3-base:1.9 pkgsrc-2013Q2:1.9.0.82 pkgsrc-2013Q2-base:1.9 pkgsrc-2013Q1:1.9.0.80 pkgsrc-2013Q1-base:1.9 pkgsrc-2012Q4:1.9.0.78 pkgsrc-2012Q4-base:1.9 pkgsrc-2012Q3:1.9.0.76 pkgsrc-2012Q3-base:1.9 pkgsrc-2012Q2:1.9.0.74 pkgsrc-2012Q2-base:1.9 pkgsrc-2012Q1:1.9.0.72 pkgsrc-2012Q1-base:1.9 pkgsrc-2011Q4:1.9.0.70 pkgsrc-2011Q4-base:1.9 pkgsrc-2011Q3:1.9.0.68 pkgsrc-2011Q3-base:1.9 pkgsrc-2011Q2:1.9.0.66 pkgsrc-2011Q2-base:1.9 pkgsrc-2011Q1:1.9.0.64 pkgsrc-2011Q1-base:1.9 pkgsrc-2010Q4:1.9.0.62 pkgsrc-2010Q4-base:1.9 pkgsrc-2010Q3:1.9.0.60 pkgsrc-2010Q3-base:1.9 pkgsrc-2010Q2:1.9.0.58 pkgsrc-2010Q2-base:1.9 pkgsrc-2010Q1:1.9.0.56 pkgsrc-2010Q1-base:1.9 pkgsrc-2009Q4:1.9.0.54 pkgsrc-2009Q4-base:1.9 pkgsrc-2009Q3:1.9.0.52 pkgsrc-2009Q3-base:1.9 pkgsrc-2009Q2:1.9.0.50 pkgsrc-2009Q2-base:1.9 pkgsrc-2009Q1:1.9.0.48 pkgsrc-2009Q1-base:1.9 pkgsrc-2008Q4:1.9.0.46 pkgsrc-2008Q4-base:1.9 pkgsrc-2008Q3:1.9.0.44 pkgsrc-2008Q3-base:1.9 cube-native-xorg:1.9.0.42 cube-native-xorg-base:1.9 pkgsrc-2008Q2:1.9.0.40 pkgsrc-2008Q2-base:1.9 cwrapper:1.9.0.38 pkgsrc-2008Q1:1.9.0.36 pkgsrc-2008Q1-base:1.9 pkgsrc-2007Q4:1.9.0.34 pkgsrc-2007Q4-base:1.9 pkgsrc-2007Q3:1.9.0.32 pkgsrc-2007Q3-base:1.9 pkgsrc-2007Q2:1.9.0.30 pkgsrc-2007Q2-base:1.9 pkgsrc-2007Q1:1.9.0.28 pkgsrc-2007Q1-base:1.9 pkgsrc-2006Q4:1.9.0.26 pkgsrc-2006Q4-base:1.9 pkgsrc-2006Q3:1.9.0.24 pkgsrc-2006Q3-base:1.9 pkgsrc-2006Q2:1.9.0.22 pkgsrc-2006Q2-base:1.9 pkgsrc-2006Q1:1.9.0.20 pkgsrc-2006Q1-base:1.9 pkgsrc-2005Q4:1.9.0.18 pkgsrc-2005Q4-base:1.9 pkgsrc-2005Q3:1.9.0.16 pkgsrc-2005Q3-base:1.9 pkgsrc-2005Q2:1.9.0.14 pkgsrc-2005Q2-base:1.9 pkgsrc-2005Q1:1.9.0.12 pkgsrc-2005Q1-base:1.9 pkgsrc-2004Q4:1.9.0.10 pkgsrc-2004Q4-base:1.9 pkgsrc-2004Q3:1.9.0.8 pkgsrc-2004Q3-base:1.9 pkgsrc-2004Q2:1.9.0.6 pkgsrc-2004Q2-base:1.9 pkgsrc-2004Q1:1.9.0.4 pkgsrc-2004Q1-base:1.9 pkgsrc-2003Q4:1.9.0.2 pkgsrc-2003Q4-base:1.9 netbsd-1-6:1.4.0.8 netbsd-1-6-RELEASE-base:1.4 pkgviews:1.4.0.4 pkgviews-base:1.4 buildlink2:1.4.0.2 buildlink2-base:1.4 netbsd-1-5-PATCH003:1.4 netbsd-1-5-PATCH001:1.3 netbsd-1-5-RELEASE:1.2 netbsd-1-4-PATCH003:1.2; locks; strict; comment @# @; 1.10 date 2016.10.19.20.22.31; author wiz; state dead; branches; next 1.9; commitid jZUIGLgkvc7EkNqz; 1.9 date 2003.06.24.10.22.47; author wiz; state Exp; branches; next 1.8; 1.8 date 2003.05.23.09.39.53; author wiz; state Exp; branches; next 1.7; 1.7 date 2003.02.21.22.05.02; author mycroft; state dead; branches; next 1.6; 1.6 date 2003.02.15.10.48.27; author wiz; state Exp; branches; next 1.5; 1.5 date 2002.10.28.22.37.11; author wiz; state dead; branches; next 1.4; 1.4 date 2002.03.19.15.34.32; author wiz; state Exp; branches; next 1.3; 1.3 date 2001.02.08.05.57.53; author fredb; state Exp; branches; next 1.2; 1.2 date 2000.07.26.18.15.04; author frueauf; state Exp; branches; next 1.1; 1.1 date 2000.04.24.14.57.49; author hubertf; state Exp; branches; next ; desc @@ 1.10 log @Remove old, undocumented patches where I can't even find reasoning in the CVS logs. Not needed on NetBSD, let me know if they are needed anywhere else. @ text @$NetBSD: patch-ae,v 1.9 2003/06/24 10:22:47 wiz Exp $ --- driver/xscreensaver.h.orig Sat Jun 7 10:22:21 2003 +++ driver/xscreensaver.h @@@@ -12,6 +12,7 @@@@ #ifndef __XSCREENSAVER_H__ #define __XSCREENSAVER_H__ +#include #include #ifdef HAVE_UNISTD_H # include @ 1.9 log @Update to 4.11: * New hacks, `hypertorus', `cubestorm', `glknots', `blocktube', and `glmatrix'. * Updates to `cloudlife', `engine', `xmatrix', and `sonar'. * Rewrote `glslideshow': it should work on somewhat wimpier video cards now. * Various portability tweaks. @ text @d1 1 a1 1 $NetBSD$ @ 1.8 log @Update to 4.10: Changes since 4.09: * New hacks, `cloudlife' and `klein'. * Added Apple ][+, HPUX, and OS/390 sessions to BSOD. * Added some Matrix Reloaded text to `xmatrix'. * Updates to `webcollage', `eruption', `jigglypuff', `metaballs', and `endgame'. * Completely ignore the `memoryLimit' setting now. @ text @d3 10 a12 851 --- hacks/glx/klein.c.orig Tue May 20 13:33:47 2003 +++ hacks/glx/klein.c @@@@ -1,424 +1,424 @@@@ -/* -*- Mode: C; tab-width: 4 -*- */ -/* Klein --- Klein Bottle, Moebius and other parametric surfaces - * visualization */ - -/* - * Revision History: - * 2000: written by Andrey Mirtchovski - -#ifdef STANDALONE -# define PROGCLASS "Klein" -# define HACK_INIT init_klein -# define HACK_DRAW draw_klein -# define HACK_RESHAPE reshape_klein -# define HACK_HANDLE_EVENT klein_handle_event -# define EVENT_MASK PointerMotionMask -# define klein_opts xlockmore_opts - - -#define DEF_SPIN "True" -#define DEF_WANDER "False" -#define DEF_RANDOM "False" -#define DEF_SPEED "150" - -# define DEFAULTS "*delay: 20000 \n" \ - "*showFPS: False \n" \ - "*wireframe: False \n" \ - "*random: " DEF_RANDOM "\n" \ - "*speed: " DEF_SPEED "\n" \ - "*spin: " DEF_SPIN "\n" \ - "*wander: " DEF_WANDER "\n" \ - -# include "xlockmore.h" /* from the xscreensaver distribution */ -#else /* !STANDALONE */ -# include "xlock.h" /* from the xlockmore distribution */ -#endif /* !STANDALONE */ - -#ifdef USE_GL - -#include -#include "rotator.h" -#include "gltrackball.h" - -#undef countof -#define countof(x) (sizeof((x))/sizeof((*x))) - -/* surfaces being drawn */ -enum { - KLEIN = 0, - DINI, - ENNEPER, - KUEN, - MOEBIUS, - SEASHELL, - SWALLOWTAIL, - BOHEM, - SURFACE_LAST, -}; - -/* primitives to draw with - * note that we skip the polygons and - * triangle fans -- too slow - * - * also removed triangle_strip and quads -- - * just doesn't look good enough - */ -enum { - MY_POINTS = 0, - MY_LINES, - MY_LINE_LOOP, - MY_PRIM_LAST, -}; - - -static Bool rand; -static int render; -static int speed; -static Bool do_spin; -static Bool do_wander; - -static XrmOptionDescRec opts[] = { - {"-speed", ".speed", XrmoptionSepArg, (caddr_t) 0 }, - { "-spin", ".spin", XrmoptionNoArg, "True" }, - { "+spin", ".spin", XrmoptionNoArg, "False" }, - { "-wander", ".wander", XrmoptionNoArg, "True" }, - { "+wander", ".wander", XrmoptionNoArg, "False" }, - { "-random", ".rand", XrmoptionNoArg, "True" }, - { "+random", ".rand", XrmoptionNoArg, "False" }, -}; - -static argtype vars[] = { - {(caddr_t *) &rand, "rand", "Random", DEF_RANDOM, t_Bool}, - {(caddr_t *) &do_spin, "spin", "Spin", DEF_SPIN, t_Bool}, - {(caddr_t *) &do_wander, "wander", "Wander", DEF_WANDER, t_Bool}, - {(caddr_t *) &speed, "speed", "Speed", DEF_SPEED, t_Int}, -}; - - -ModeSpecOpt klein_opts = {countof(opts), opts, countof(vars), vars, NULL}; - - - -typedef struct{ - GLfloat x; - GLfloat y; - GLfloat z; -} GL_VECTOR; - -typedef struct { - GLXContext *glx_context; - Window window; - rotator *rot; - trackball_state *trackball; - Bool button_down_p; - - int render; - int surface; - - float du, dv; - float a, b, c; - -} kleinstruct; - -static kleinstruct *klein = NULL; - - -static void -draw(ModeInfo *mi) -{ - kleinstruct *kp = &klein[MI_SCREEN(mi)]; - static float step = 0.0; - double u, v; - float coord[3]; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glEnable(GL_DEPTH_TEST); - glEnable(GL_NORMALIZE); - glEnable(GL_CULL_FACE); - - glPushMatrix(); - - { - double x, y, z; - get_position (kp->rot, &x, &y, &z, !kp->button_down_p); - glTranslatef((x - 0.5) * 10, - (y - 0.5) * 10, - (z - 0.5) * 20); - - gltrackball_rotate (kp->trackball); - - get_rotation (kp->rot, &x, &y, &z, !kp->button_down_p); - glRotatef (x * 360, 1.0, 0.0, 0.0); - glRotatef (y * 360, 0.0, 1.0, 0.0); - glRotatef (z * 360, 0.0, 0.0, 1.0); - } - - glScalef( 4.0, 4.0, 4.0 ); - - glBegin(kp->render); - switch(kp->surface) { - case KLEIN: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = cos(u)*(kp->a + sin(v)*cos(u/2) - - sin(2*v)*sin(u/2)/2); - coord[1] = sin(u)*(kp->a + sin(v)*cos(u/2) - - sin(2*v)*sin(u/2)/2); - coord[2] = sin(u/2)*sin(v) + cos(u/2)*sin(2*v)/2; - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case DINI: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = kp->a*cos(u)*sin(v); - coord[1] = kp->a*sin(u)*sin(v); - coord[2] = kp->a*(cos(v) + sin(tan((v/2))))+0.2*u; - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case ENNEPER: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = kp->a*(u-(u*u*u/3)+u*v*v); - coord[1] = kp->b*(v-(v*v*v/3)+u*u*v); - coord[2] = u*u-v*v; - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case KUEN: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = 2*(cos(u)+u*sin(u))*sin(v)/(1+u*u*sin(v)*sin(v)); - coord[1] = 2*(sin(u)-u*cos(u))*sin(v)/(1+u*u*sin(v)*sin(v)); - coord[2] = sin(tan(v/2))+2*cos(v)/(1+u*u*sin(v)*sin(v)); - - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case MOEBIUS: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = cos(u)+v*cos(u/2)*cos(u); - coord[1] = sin(u)+v*cos(u/2)*sin(u); - coord[2] = v*sin(u/2); - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case SEASHELL: - for(u = 0; u < 2*M_PI; u+=kp->du){ - for(v = 0; v < 2*M_PI; v+=kp->dv){ - coord[0] = kp->a*(1-v/(2*M_PI))*cos(2*v)*(1+cos(u))+sin(kp->c+=0.00001)*cos(2*v); - coord[1] = kp->a*(1-v/(2*M_PI))*sin(2*v)*(1+cos(u))+cos(kp->c+=0.00001)*sin(2*v); - coord[2] = sin(kp->b+=0.00001)*v/(2*M_PI)+kp->a*(1-v/(2*M_PI))*sin(u); - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case SWALLOWTAIL: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = u*pow(v,2) + 3*pow(v,4); - coord[1] = -2*u*v - 4*pow(v,3); - coord[2] = u; - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - case BOHEM: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = kp->a*cos(u); - coord[1] = 1.5*cos(v) + kp->a*sin(u); - coord[2] = sin(v); - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - default: - for(u = -M_PI; u < M_PI; u+=kp->du){ - for(v = -M_PI; v < M_PI; v+=kp->dv){ - coord[0] = sin(u)*kp->a; - coord[1] = cos(u)*kp->a; - coord[2] = sin(u/2)*cos(v) + cos(u/2)*sin(v); - glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); - glVertex3fv(coord); - } - } - break; - } - glEnd(); - glPopMatrix(); - - - kp->a = sin(step+=0.01); - kp->b = cos(step+=0.01); -} - - -/* new window size or exposure */ -void -reshape_klein(ModeInfo *mi, int width, int height) -{ - GLfloat h = (GLfloat) height / (GLfloat) width; - - glViewport(0, 0, (GLint) width, (GLint) height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective (30.0, 1/h, 1.0, 100.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - gluLookAt( 0.0, 0.0, 30.0, - 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0); - - glClear(GL_COLOR_BUFFER_BIT); -} - - -Bool -klein_handle_event (ModeInfo *mi, XEvent *event) -{ - kleinstruct *kp = &klein[MI_SCREEN(mi)]; - - if (event->xany.type == ButtonPress && event->xbutton.button & Button1) { - kp->button_down_p = True; - gltrackball_start (kp->trackball, event->xbutton.x, event->xbutton.y, MI_WIDTH (mi), MI_HEIGHT (mi)); - return True; - } else if (event->xany.type == ButtonRelease && event->xbutton.button & Button1) { - kp->button_down_p = False; - return True; - } else if (event->xany.type == MotionNotify && kp->button_down_p) { - gltrackball_track (kp->trackball, event->xmotion.x, event->xmotion.y, MI_WIDTH (mi), MI_HEIGHT (mi)); - return True; - } - - return False; -} - - -void -init_klein(ModeInfo *mi) -{ - int screen = MI_SCREEN(mi); - kleinstruct *kp; - - if (klein == NULL) { - if ((klein = (kleinstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (kleinstruct))) == NULL) - return; - } - kp = &klein[screen]; - - kp->window = MI_WINDOW(mi); - - { - double spin_speed = 1.0; - double wander_speed = 0.03; - kp->rot = make_rotator (do_spin ? spin_speed : 0, - do_spin ? spin_speed : 0, - do_spin ? spin_speed : 0, - 1.0, - do_wander ? wander_speed : 0, - True); - kp->trackball = gltrackball_init (); - } - - if(rand) { - render = random() % MY_PRIM_LAST; - kp->surface = random() % SURFACE_LAST; - } else { - render = MY_LINE_LOOP; - kp->surface = KLEIN; - } - - switch (render) { - case MY_POINTS: kp->render = GL_POINTS; break; - case MY_LINES: kp->render = GL_LINES; break; - case MY_LINE_LOOP: kp->render = GL_LINE_LOOP; break; - default: - kp->render = GL_LINE_LOOP; - } -/*kp->render=GL_TRIANGLE_FAN;*/ -/*kp->render=GL_POLYGON;*/ - - kp->du = 0.07; - kp->dv = 0.07; - kp->a = kp->b = 1; - kp->c = 0.1; - - - if ((kp->glx_context = init_GL(mi)) != NULL) { - reshape_klein(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); - } else { - MI_CLEARWINDOW(mi); - } -} - -void -draw_klein(ModeInfo * mi) -{ - kleinstruct *kp = &klein[MI_SCREEN(mi)]; - Display *display = MI_DISPLAY(mi); - Window window = MI_WINDOW(mi); - - if (!kp->glx_context) return; - - glDrawBuffer(GL_BACK); - - glXMakeCurrent(display, window, *(kp->glx_context)); - draw(mi); - if (mi->fps_p) do_fps (mi); - glFinish(); - glXSwapBuffers(display, window); -} - -void -release_klein(ModeInfo * mi) -{ - if (klein != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { - kleinstruct *kp = &klein[screen]; - - if (kp->glx_context) { - /* Display lists MUST be freed while their glXContext is current. */ - glXMakeCurrent(MI_DISPLAY(mi), kp->window, *(kp->glx_context)); - } - } - (void) free((void *) klein); - klein = NULL; - } - FreeAllGL(mi); -} - - -/*********************************************************/ - -#endif +/* -*- Mode: C; tab-width: 4 -*- */ +/* Klein --- Klein Bottle, Moebius and other parametric surfaces + * visualization */ + +/* + * Revision History: + * 2000: written by Andrey Mirtchovski + +#ifdef STANDALONE +# define PROGCLASS "Klein" +# define HACK_INIT init_klein +# define HACK_DRAW draw_klein +# define HACK_RESHAPE reshape_klein +# define HACK_HANDLE_EVENT klein_handle_event +# define EVENT_MASK PointerMotionMask +# define klein_opts xlockmore_opts + + +#define DEF_SPIN "True" +#define DEF_WANDER "False" +#define DEF_RANDOM "False" +#define DEF_SPEED "150" + +# define DEFAULTS "*delay: 20000 \n" \ + "*showFPS: False \n" \ + "*wireframe: False \n" \ + "*random: " DEF_RANDOM "\n" \ + "*speed: " DEF_SPEED "\n" \ + "*spin: " DEF_SPIN "\n" \ + "*wander: " DEF_WANDER "\n" \ + +# include "xlockmore.h" /* from the xscreensaver distribution */ +#else /* !STANDALONE */ +# include "xlock.h" /* from the xlockmore distribution */ +#endif /* !STANDALONE */ + +#ifdef USE_GL + +#include +#include "rotator.h" +#include "gltrackball.h" + +#undef countof +#define countof(x) (sizeof((x))/sizeof((*x))) + +/* surfaces being drawn */ +enum { + KLEIN = 0, + DINI, + ENNEPER, + KUEN, + MOEBIUS, + SEASHELL, + SWALLOWTAIL, + BOHEM, + SURFACE_LAST, +}; + +/* primitives to draw with + * note that we skip the polygons and + * triangle fans -- too slow + * + * also removed triangle_strip and quads -- + * just doesn't look good enough + */ +enum { + MY_POINTS = 0, + MY_LINES, + MY_LINE_LOOP, + MY_PRIM_LAST, +}; + + +static Bool rand; +static int render; +static int speed; +static Bool do_spin; +static Bool do_wander; + +static XrmOptionDescRec opts[] = { + {"-speed", ".speed", XrmoptionSepArg, (caddr_t) 0 }, + { "-spin", ".spin", XrmoptionNoArg, "True" }, + { "+spin", ".spin", XrmoptionNoArg, "False" }, + { "-wander", ".wander", XrmoptionNoArg, "True" }, + { "+wander", ".wander", XrmoptionNoArg, "False" }, + { "-random", ".rand", XrmoptionNoArg, "True" }, + { "+random", ".rand", XrmoptionNoArg, "False" }, +}; + +static argtype vars[] = { + {(caddr_t *) &rand, "rand", "Random", DEF_RANDOM, t_Bool}, + {(caddr_t *) &do_spin, "spin", "Spin", DEF_SPIN, t_Bool}, + {(caddr_t *) &do_wander, "wander", "Wander", DEF_WANDER, t_Bool}, + {(caddr_t *) &speed, "speed", "Speed", DEF_SPEED, t_Int}, +}; + + +ModeSpecOpt klein_opts = {countof(opts), opts, countof(vars), vars, NULL}; + + + +typedef struct{ + GLfloat x; + GLfloat y; + GLfloat z; +} GL_VECTOR; + +typedef struct { + GLXContext *glx_context; + Window window; + rotator *rot; + trackball_state *trackball; + Bool button_down_p; + + int render; + int surface; + + float du, dv; + float a, b, c; + +} kleinstruct; + +static kleinstruct *klein = NULL; + + +static void +draw(ModeInfo *mi) +{ + kleinstruct *kp = &klein[MI_SCREEN(mi)]; + static float step = 0.0; + double u, v; + float coord[3]; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_NORMALIZE); + glEnable(GL_CULL_FACE); + + glPushMatrix(); + + { + double x, y, z; + get_position (kp->rot, &x, &y, &z, !kp->button_down_p); + glTranslatef((x - 0.5) * 10, + (y - 0.5) * 10, + (z - 0.5) * 20); + + gltrackball_rotate (kp->trackball); + + get_rotation (kp->rot, &x, &y, &z, !kp->button_down_p); + glRotatef (x * 360, 1.0, 0.0, 0.0); + glRotatef (y * 360, 0.0, 1.0, 0.0); + glRotatef (z * 360, 0.0, 0.0, 1.0); + } + + glScalef( 4.0, 4.0, 4.0 ); + + glBegin(kp->render); + switch(kp->surface) { + case KLEIN: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = cos(u)*(kp->a + sin(v)*cos(u/2) - + sin(2*v)*sin(u/2)/2); + coord[1] = sin(u)*(kp->a + sin(v)*cos(u/2) - + sin(2*v)*sin(u/2)/2); + coord[2] = sin(u/2)*sin(v) + cos(u/2)*sin(2*v)/2; + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case DINI: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = kp->a*cos(u)*sin(v); + coord[1] = kp->a*sin(u)*sin(v); + coord[2] = kp->a*(cos(v) + sin(tan((v/2))))+0.2*u; + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case ENNEPER: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = kp->a*(u-(u*u*u/3)+u*v*v); + coord[1] = kp->b*(v-(v*v*v/3)+u*u*v); + coord[2] = u*u-v*v; + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case KUEN: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = 2*(cos(u)+u*sin(u))*sin(v)/(1+u*u*sin(v)*sin(v)); + coord[1] = 2*(sin(u)-u*cos(u))*sin(v)/(1+u*u*sin(v)*sin(v)); + coord[2] = sin(tan(v/2))+2*cos(v)/(1+u*u*sin(v)*sin(v)); + + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case MOEBIUS: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = cos(u)+v*cos(u/2)*cos(u); + coord[1] = sin(u)+v*cos(u/2)*sin(u); + coord[2] = v*sin(u/2); + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case SEASHELL: + for(u = 0; u < 2*M_PI; u+=kp->du){ + for(v = 0; v < 2*M_PI; v+=kp->dv){ + coord[0] = kp->a*(1-v/(2*M_PI))*cos(2*v)*(1+cos(u))+sin(kp->c+=0.00001)*cos(2*v); + coord[1] = kp->a*(1-v/(2*M_PI))*sin(2*v)*(1+cos(u))+cos(kp->c+=0.00001)*sin(2*v); + coord[2] = sin(kp->b+=0.00001)*v/(2*M_PI)+kp->a*(1-v/(2*M_PI))*sin(u); + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case SWALLOWTAIL: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = u*pow(v,2) + 3*pow(v,4); + coord[1] = -2*u*v - 4*pow(v,3); + coord[2] = u; + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + case BOHEM: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = kp->a*cos(u); + coord[1] = 1.5*cos(v) + kp->a*sin(u); + coord[2] = sin(v); + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + default: + for(u = -M_PI; u < M_PI; u+=kp->du){ + for(v = -M_PI; v < M_PI; v+=kp->dv){ + coord[0] = sin(u)*kp->a; + coord[1] = cos(u)*kp->a; + coord[2] = sin(u/2)*cos(v) + cos(u/2)*sin(v); + glColor3f(coord[0]+0.7, coord[1]+0.7, coord[2]+0.7); + glVertex3fv(coord); + } + } + break; + } + glEnd(); + glPopMatrix(); + + + kp->a = sin(step+=0.01); + kp->b = cos(step+=0.01); +} + + +/* new window size or exposure */ +void +reshape_klein(ModeInfo *mi, int width, int height) +{ + GLfloat h = (GLfloat) height / (GLfloat) width; + + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective (30.0, 1/h, 1.0, 100.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt( 0.0, 0.0, 30.0, + 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0); + + glClear(GL_COLOR_BUFFER_BIT); +} + + +Bool +klein_handle_event (ModeInfo *mi, XEvent *event) +{ + kleinstruct *kp = &klein[MI_SCREEN(mi)]; + + if (event->xany.type == ButtonPress && event->xbutton.button & Button1) { + kp->button_down_p = True; + gltrackball_start (kp->trackball, event->xbutton.x, event->xbutton.y, MI_WIDTH (mi), MI_HEIGHT (mi)); + return True; + } else if (event->xany.type == ButtonRelease && event->xbutton.button & Button1) { + kp->button_down_p = False; + return True; + } else if (event->xany.type == MotionNotify && kp->button_down_p) { + gltrackball_track (kp->trackball, event->xmotion.x, event->xmotion.y, MI_WIDTH (mi), MI_HEIGHT (mi)); + return True; + } + + return False; +} + + +void +init_klein(ModeInfo *mi) +{ + int screen = MI_SCREEN(mi); + kleinstruct *kp; + + if (klein == NULL) { + if ((klein = (kleinstruct *) calloc(MI_NUM_SCREENS(mi), sizeof (kleinstruct))) == NULL) + return; + } + kp = &klein[screen]; + + kp->window = MI_WINDOW(mi); + + { + double spin_speed = 1.0; + double wander_speed = 0.03; + kp->rot = make_rotator (do_spin ? spin_speed : 0, + do_spin ? spin_speed : 0, + do_spin ? spin_speed : 0, + 1.0, + do_wander ? wander_speed : 0, + True); + kp->trackball = gltrackball_init (); + } + + if(rand) { + render = random() % MY_PRIM_LAST; + kp->surface = random() % SURFACE_LAST; + } else { + render = MY_LINE_LOOP; + kp->surface = KLEIN; + } + + switch (render) { + case MY_POINTS: kp->render = GL_POINTS; break; + case MY_LINES: kp->render = GL_LINES; break; + case MY_LINE_LOOP: kp->render = GL_LINE_LOOP; break; + default: + kp->render = GL_LINE_LOOP; + } +/*kp->render=GL_TRIANGLE_FAN;*/ +/*kp->render=GL_POLYGON;*/ + + kp->du = 0.07; + kp->dv = 0.07; + kp->a = kp->b = 1; + kp->c = 0.1; + + + if ((kp->glx_context = init_GL(mi)) != NULL) { + reshape_klein(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + } else { + MI_CLEARWINDOW(mi); + } +} + +void +draw_klein(ModeInfo * mi) +{ + kleinstruct *kp = &klein[MI_SCREEN(mi)]; + Display *display = MI_DISPLAY(mi); + Window window = MI_WINDOW(mi); + + if (!kp->glx_context) return; + + glDrawBuffer(GL_BACK); + + glXMakeCurrent(display, window, *(kp->glx_context)); + draw(mi); + if (mi->fps_p) do_fps (mi); + glFinish(); + glXSwapBuffers(display, window); +} + +void +release_klein(ModeInfo * mi) +{ + if (klein != NULL) { + int screen; + + for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { + kleinstruct *kp = &klein[screen]; + + if (kp->glx_context) { + /* Display lists MUST be freed while their glXContext is current. */ + glXMakeCurrent(MI_DISPLAY(mi), kp->window, *(kp->glx_context)); + } + } + (void) free((void *) klein); + klein = NULL; + } + FreeAllGL(mi); +} + + +/*********************************************************/ + +#endif @ 1.7 log @Update to xscreensaver 4.08. Changes since 4.07: * New hacks, `atunnels' and `piecewise'. * Physics improvement in `fluidballs'. * Various fixes for XDarwin systems (X11 on MacOS X.) * Added -clock option to `barcode'. * Minor fixes to `endgame', `flurry', `flipscreen3d', and `gflux'. @ text @d1 1 a1 1 $NetBSD: patch-ae,v 1.6 2003/02/15 10:48:27 wiz Exp $ d3 851 a853 10 --- hacks/glx/flurry.c.orig Mon Feb 3 11:48:30 2003 +++ hacks/glx/flurry.c @@@@ -103,7 +103,6 @@@@ ModStruct flurry_description = { #endif #include -#include #include "flurry.h" @ 1.6 log @Update to 4.07: * New hacks, `flurry', `metaballs', `eruption', `popsquares', and `barcode'. * Minor updates to `maze' for high density mazes. * Added double buffering to `fluidballs' and `whirlygig'. * Bug fixes for running xscreensaver to a remote XFree86 display (which nobody would ever do...) * Updated `webcollage' (faster Alta Vista searching.) * Updated `glplanet' so the sun sets in the west. * Updated `sproingies' with smooth, unsegmented surfaces. * Fixed Perl version-sensitivity in `xscreensaver-getimage-file'. * Fixed GTK2 scrolling bug in `xscreensaver-demo'. @ text @d1 1 a1 1 $NetBSD$ @ 1.5 log @Update to 4.06. Changes since 4.05: * New hack, `glblur' (disabled by default, since it requires fast OpenGL texture support.) * New hack, `halftone'. * Updates to `endgame', `queens', `bumps', `glplanet', `engine', and `circuit'. * New version of `menger' that uses far fewer polygons. * Fixed minor bug in `critical' that could cause some bogus X servers to crash. * Better labels in `molecule': the labels now appear to be attached to the atoms, instead of floating in front of the whole scene. * Fixed bug that could rarely cause GL hacks to fail to double-buffer (causing intermittent flickering.) * Fixed a relative-URL-parsing bug in `webcollage'. * Fixed a bug that (sometimes) caused the window manager close box to kill `xscreensaver-demo' with a crash instead of a graceful exit. * Updated xscreensaver.pam to the Red Hat 7.3 way. * More Gnome2-related configure crap. * Updated to latest `config.guess' and `config.sub'. * Fixed occasional core dump in `distort'. * Added a Linux fsck failure and kernel panic to `bsod'. * Added MacOS X kernel panic to `bsod'. * Fixed a bug in `bsod' (all bsod bugs are ironic.) * Fixed a bug that caused `xscreensaver-gl-helper' to print a nonsense visual ID with some versions of `printf': this could cause GL programs to display incorrectly (e.g., flickery.) Changes since 4.04: * More `configure' tweaks to try and get things working on systems that both Gtk 1.x and 2.x installed. * New hack, `endgame'. * Minor updates to `gltext'. Changes since 4.03: * Support for GTK 2.x / GNOME 2.x. * The `configure' script will now use `pkg-config' if you have it, in preference to `gtk-config', etc. * New hacks, `lavalite', `queens', and `anemone'. * Minor updates to `spheremonics', `gltext', `xmatrix'. * You can use the mouse to manually spin most of the GL hacks now (when they are displaying in a window.) * Fixed a bug in `webcollage' (due to recent Alta Vista url changes) that was causing it to try and load incorrect image URLs. * Made `xscreensaver-getimage' use gdk_pixbuf if it is available: this means that those hacks that load images will no longer rely on "xv", "xloadimage", etc. This will close a race condition that could sometimes cause your desktop background to be changed; and also makes it possible for those programs to operate on image files when running in windowed mode. * `webcollage' can now be used in conjunction with `driftnet' to display images snooped from your local ethernet instead of obtained from search engines. * Added man pages for all the hacks that didn't have them. Changes since 4.02: * New hack, `spheremonics'. * Minor updates to `webcollage', `cage', `moebius', `morph3d', `boxed', `circuit', and `helix'. * `pulsar' and `extrusion' can now load texture JPEGs. * `rubik' now does non-square cubes. * `fluidballs' now does various sizes of balls. * `menger' and `sierpinski3d' now also show polygon counts in -fps mode. * `molecule' displays real subscripts in the formulae. * GTK internationalization/localization support. * Better detection of the various versions of libxml. * Upgraded to autoconf 2.53 (from 2.13.) @ text @d1 1 a1 1 $NetBSD: patch-ae,v 1.4 2002/03/19 15:34:32 wiz Exp $ d3 4 a6 5 --- driver/xscreensaver.kss.orig Thu Feb 1 02:06:02 2001 +++ driver/xscreensaver.kss @@@@ -1,4 +1,4 @@@@ -#!/bin/bash - +#!/bin/sh - d8 2 a9 12 # script - "xscreensaver.kss" # @@@@ -40,15 +40,15 @@@@ # 2) Hack xscreensaver to accept alternate setup files, and create one on # the fly here. shift - /usr/X11R6/lib/xscreensaver/xflame -delay 1 -window-id $1 & # Start new preview + @@PREFIX@@/libexec/xscreensaver/xflame -delay 1 -window-id $1 & # Start new preview echo "$!" > $HOME/.kss-preview$1.pid.`hostname` # Write PID wait $! # Wait for it to get killed exit ;; d11 1 a11 33 -setup) - /usr/X11R6/bin/xscreensaver -no-splash & # daemon must be started - /usr/X11R6/bin/xscreensaver-demo # or the setup will produce + @@PREFIX@@/bin/xscreensaver -no-splash & # daemon must be started + @@PREFIX@@/bin/xscreensaver-demo # or the setup will produce kill $! # a warning. exit ;; @@@@ -57,8 +57,8 @@@@ # I was unable to grep stdout because xscreensaver nabs it. But I was able # to output it to a file, and grep the file. TEMP_FILE=/tmp/xsc.$RANDOM - /usr/X11R6/bin/xscreensaver -no-splash -verbose -no-capture-stderr 2> $TEMP_FILE & - /usr/X11R6/bin/xscreensaver-command -activate + @@PREFIX@@/bin/xscreensaver -no-splash -verbose -no-capture-stderr 2> $TEMP_FILE & + @@PREFIX@@/bin/xscreensaver-command -activate while true; do ExitNow=$(grep -E -c unblanking\|already $TEMP_FILE) if [ $ExitNow != 0 ]; then @@@@ -109,12 +109,12 @@@@ kill `cat $PID_FILE` # Kill old screensaver fi echo "$$" > $PID_FILE # Write PID of this script - /usr/X11R6/bin/xscreensaver -no-splash $timeout $lockmode $Nice & # Start XScreenSaver daemon + @@PREFIX@@/xscreensaver -no-splash $timeout $lockmode $Nice & # Start XScreenSaver daemon trap "kill $!" SIGTERM # Set these to kill the daemon trap "kill $!" SIGKILL # KDE sends SIGUSER1 to indicate the user has hit the "lock" button. - trap "/usr/X11R6/bin/xscreensaver-command -lock" SIGUSR1 + trap "@@PREFIX@@/bin/xscreensaver-command -lock" SIGUSR1 wait $! # Do not exit, just wait for signals. @ 1.4 log @Update xscreensaver and xscreensaver-gnome to 4.02. * Plugged a few minor leaks in `xscreensaver' and `xscreensaver-demo'. * New hacks, `cubenetic' and `fluidballs'. * Sped up `pipes'. * Fixed sphere projection error in `glplanet'; installed a better image of earth. * Added Win2K and MacOS 1 crashes to `bsod'. * Put back previous (better) version of `forest' that was accidentially downgraded in the last release. * New version of `bumps'. * Made FPS computation in GL hacks more efficient: it will influence the results less, thus resulting in higher (but more accurate) reported frame rates. @ text @d1 1 a1 1 $NetBSD$ @ 1.3 log @Update to 3.28 -- new "hacks", bug fixes, configure updates for XFree86-4 and *BSD (allows to simplify the package somewhat), and revamped Screensaver Options: xscreensaver now lets you configure your DPMS settings. More detail on the web page -- http://www.jwz.org/xscreensaver/changelog.html [The README in the package currently only goes to 3.27.] @ text @d1 1 a1 1 $NetBSD: patch-ae,v 1.2 2000/07/26 18:15:04 frueauf Exp $ d3 2 a4 2 --- driver/xscreensaver.kss.orig Wed Jan 31 19:06:02 2001 +++ driver/xscreensaver.kss Wed Feb 7 23:31:02 2001 @ 1.2 log @Update xscreensaver to 3.25. Changes since 3.24: * New hack, `nerverot'. * Added BSD kernel panic to `bsod'. * New version of `shadebobs'. * New version of `petri'. * Updated `webcollage' to handle recent Altavista URL format changes; made it search the AP photo gallery. * Revamped command-line options of `sonar' and made it properly handle subnets. * The `bubbles' hack can now trickle up or down the screen . * The `xsublim' hack can now read its text from programs. * Support for GLE version 3 in `extrusion'. * Fixed compilation problems in `maze'. * Fixed a rare crash in `flow'. * Fixes for minor installation problems. @ text @d1 1 a1 1 $NetBSD$ d3 2 a4 2 --- driver/xscreensaver.kss.orig Mon Jul 17 08:24:09 2000 +++ driver/xscreensaver.kss Tue Jul 25 23:27:47 2000 d15 2 a16 2 - /usr/X11R6/lib/xscreensaver/xroger -delay 1 -window-id $1 & # Start new preview + @@PREFIX@@/lib/xscreensaver/xroger -delay 1 -window-id $1 & # Start new preview @ 1.1 log @Address PR 9970 by Jason Thorpe: * unconditionally install xscreensaver.kss (KDE screensaver module), don't rely on the user having KDEDIR set in his environment * Install xscreensaver.kss using BSD_INSTALL_SCRIPT, as it's a shell script, not a binary. * xscreensaver.kss wanted /bin/bash, make it use /bin/sh * Make xscreensaver.kss aware of $PREFIX, don't hardcode /usr/X11R6 @ text @d3 2 a4 2 --- driver/xscreensaver.kss.orig Mon Apr 24 08:10:02 2000 +++ driver/xscreensaver.kss Mon Apr 24 08:10:41 2000 d41 3 a43 3 @@@@ -108,12 +108,12 @@@@ PID_FILE=$HOME/.kss-install.pid.`hostname` kill `cat $PID_FILE` # Kill old screensaver d46 1 a46 1 + @@PREFIX@@/bin/xscreensaver -no-splash $timeout $lockmode $Nice & # Start XScreenSaver daemon @