# define PROGCLASS "Pipes"
# define HACK_INIT init_pipes
# define HACK_DRAW draw_pipes
# define PROGCLASS "Pipes"
# define HACK_INIT init_pipes
# define HACK_DRAW draw_pipes
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
#define DEF_FISHEYE "True"
#define DEF_TIGHTTURNS "False"
#define DEF_ROTATEPIPES "True"
#define DEF_FISHEYE "True"
#define DEF_TIGHTTURNS "False"
#define DEF_ROTATEPIPES "True"
{"-tightturns", ".pipes.tightturns", XrmoptionNoArg, (caddr_t) "on"},
{"+tightturns", ".pipes.tightturns", XrmoptionNoArg, (caddr_t) "off"},
{"-rotatepipes", ".pipes.rotatepipes", XrmoptionNoArg, (caddr_t) "on"},
{"-tightturns", ".pipes.tightturns", XrmoptionNoArg, (caddr_t) "on"},
{"+tightturns", ".pipes.tightturns", XrmoptionNoArg, (caddr_t) "off"},
{"-rotatepipes", ".pipes.rotatepipes", XrmoptionNoArg, (caddr_t) "on"},
- {"+rotatepipes", ".pipes.rotatepipes", XrmoptionNoArg, (caddr_t) "off"}
+ {"+rotatepipes", ".pipes.rotatepipes", XrmoptionNoArg, (caddr_t) "off"},
+ {"-db", ".pipes.doubleBuffer", XrmoptionNoArg, (caddr_t) "on"},
+ {"+db", ".pipes.doubleBuffer", XrmoptionNoArg, (caddr_t) "off"},
};
static argtype vars[] =
{
{(caddr_t *) & factory, "factory", "Factory", DEF_FACTORY, t_Int},
{(caddr_t *) & fisheye, "fisheye", "Fisheye", DEF_FISHEYE, t_Bool},
{(caddr_t *) & tightturns, "tightturns", "Tightturns", DEF_TIGHTTURNS, t_Bool},
};
static argtype vars[] =
{
{(caddr_t *) & factory, "factory", "Factory", DEF_FACTORY, t_Int},
{(caddr_t *) & fisheye, "fisheye", "Fisheye", DEF_FISHEYE, t_Bool},
{(caddr_t *) & tightturns, "tightturns", "Tightturns", DEF_TIGHTTURNS, t_Bool},
- {(caddr_t *) & rotatepipes, "rotatepipes", "Rotatepipes", DEF_ROTATEPIPES, t_Bool}
+ {(caddr_t *) & rotatepipes, "rotatepipes", "Rotatepipes", DEF_ROTATEPIPES, t_Bool},
+ {(caddr_t *) & dbuf_p, "doubleBuffer", "DoubleBuffer", DEF_DBUF, t_Bool}
};
static OptionStruct desc[] =
{
{"-factory num", "how much extra equipment in pipes (0 for none)"},
{"-/+fisheye", "turn on/off zoomed-in view of pipes"},
{"-/+tightturns", "turn on/off tight turns"},
};
static OptionStruct desc[] =
{
{"-factory num", "how much extra equipment in pipes (0 for none)"},
{"-/+fisheye", "turn on/off zoomed-in view of pipes"},
{"-/+tightturns", "turn on/off tight turns"},
- {"-/+rotatepipes", "turn on/off pipe system rotation per screenful"}
+ {"-/+rotatepipes", "turn on/off pipe system rotation per screenful"},
+ {"-/+db", "turn on/off double buffering"}
-{7, opts, 4, vars, desc};
+{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
#ifdef USE_MODULES
ModStruct pipes_description =
{"pipes", "init_pipes", "draw_pipes", "release_pipes",
#ifdef USE_MODULES
ModStruct pipes_description =
{"pipes", "init_pipes", "draw_pipes", "release_pipes",
"change_pipes", NULL, &pipes_opts,
"change_pipes", NULL, &pipes_opts,
- 1000, 2, 5, 500, 1.0, "",
+ 1000, 2, 5, 500, 4, 1.0, "",
glCallList(pp->betweenbolts);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialGray);
glCallList(pp->bolts);
glCallList(pp->betweenbolts);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialGray);
glCallList(pp->bolts);
if (pp->system_color == MaterialRed) {
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, NRAND(2) ? MaterialYellow : MaterialBlue);
} else if (pp->system_color == MaterialBlue) {
if (pp->system_color == MaterialRed) {
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, NRAND(2) ? MaterialYellow : MaterialBlue);
} else if (pp->system_color == MaterialBlue) {
/*glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0); */
gluPerspective(65.0, (GLfloat) width / (GLfloat) height, 0.1, 20.0);
glMatrixMode(GL_MODELVIEW);
/*glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0); */
gluPerspective(65.0, (GLfloat) width / (GLfloat) height, 0.1, 20.0);
glMatrixMode(GL_MODELVIEW);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
(void) memset(pp->Cells, 0, sizeof (pp->Cells));
for (X = 0; X < HCELLS; X++) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
(void) memset(pp->Cells, 0, sizeof (pp->Cells));
for (X = 0; X < HCELLS; X++) {
- reshape(mi, MI_WIN_WIDTH(mi), MI_WIN_HEIGHT(mi));
- pp->initial_rotation = -10.0;
+ reshape_pipes(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+ if (rotatepipes)
+ pp->initial_rotation = NRAND(180); /* jwz */
+ else
+ pp->initial_rotation = -10.0;
- pp->valve = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_BigValve);
- pp->bolts = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_Bolts3D);
- pp->betweenbolts = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_PipeBetweenBolts);
+ pp->valve = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_BigValve);
+ pp->bolts = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_Bolts3D);
+ pp->betweenbolts = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_PipeBetweenBolts);
- pp->elbowbolts = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_ElbowBolts);
- pp->elbowcoins = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_ElbowCoins);
+ pp->elbowbolts = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_ElbowBolts);
+ pp->elbowcoins = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_ElbowCoins);
- pp->guagehead = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_GuageHead);
- pp->guageface = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_GuageFace);
- pp->guagedial = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_GuageDial);
- pp->guageconnector = BuildLWO(MI_WIN_IS_WIREFRAME(mi), &LWO_GuageConnector);
+ pp->guagehead = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_GuageHead);
+ pp->guageface = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_GuageFace);
+ pp->guagedial = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_GuageDial);
+ pp->guageconnector = BuildLWO(MI_IS_WIREFRAME(mi), &LWO_GuageConnector);
glPushMatrix();
glTranslatef(0.0, 0.0, fisheye ? -3.8 : -4.8);
if (rotatepipes)
glRotatef(pp->initial_rotation, 0.0, 1.0, 0.0);
glPushMatrix();
glTranslatef(0.0, 0.0, fisheye ? -3.8 : -4.8);
if (rotatepipes)
glRotatef(pp->initial_rotation, 0.0, 1.0, 0.0);
/* Width/height ratio handled by gluPerspective() now. */
glScalef(Scale4Window, Scale4Window, Scale4Window);
} else {
/* Width/height ratio handled by gluPerspective() now. */
glScalef(Scale4Window, Scale4Window, Scale4Window);
} else {
glTranslatef((pp->PX - 16) / 3.0 * 4.0, (pp->PY - 12) / 3.0 * 4.0, (pp->PZ - 16) / 3.0 * 4.0);
/* Finish the system with another sphere */
mySphere(0.6);
glTranslatef((pp->PX - 16) / 3.0 * 4.0, (pp->PY - 12) / 3.0 * 4.0, (pp->PZ - 16) / 3.0 * 4.0);
/* Finish the system with another sphere */
mySphere(0.6);
glPopMatrix();
/* If the maximum number of system was drawn, restart (clearing the screen), */
/* else start a new system. */
if (++pp->system_number > pp->number_of_systems) {
glPopMatrix();
/* If the maximum number of system was drawn, restart (clearing the screen), */
/* else start a new system. */
if (++pp->system_number > pp->number_of_systems) {
-#if defined( MESA ) && defined( SLOW )
- pp->flip = !pp->flip;
- if (pp->flip)
- glXSwapBuffers(display, window);
-#endif
+ if (dbuf_p)
+ glXSwapBuffers(display, window);
+
+ if (mi->fps_p) do_fps (mi);