#ifdef STANDALONE
#define DEFAULTS "*delay: 30000 \n" \
"*showFPS: False \n" \
+ "*suppressRotationAnimation: True\n" \
"*titleFont: -*-helvetica-medium-r-normal-*-*-180-*-*-*-*-*-*\n" \
# define refresh_engine 0
+# define release_engine 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# include "xlock.h" /* from the xlockmore distribution */
#ifdef USE_MODULES
ModStruct engine_description =
-{"engine", "init_engine", "draw_engine", "release_engine",
+{"engine", "init_engine", "draw_engine", NULL,
"draw_engine", "init_engine", NULL, &engine_opts,
1000, 1, 2, 1, 4, 1.0, "",
"A four stroke engine", 0, NULL};
for (a = sangle ; a <= angle || b <= angle ; a+= step) {
y2=outer*(float)e->sin_table[a]+y;
z2=outer*(float)e->cos_table[a]+z;
- if (endcaps)
- y2c[a] = y2; z2c[a] = z2; /* cache for later */
+ if (endcaps) {
+ y2c[a] = y2;
+ z2c[a] = z2; /* cache for later */
+ }
if (tube) {
Y2=inner*(float)e->sin_table[a]+y;
Z2=inner*(float)e->cos_table[a]+z;
int polys = 0;
GLfloat colour[] = {0.6, 0.6, 0.6, 1.0};
- if (e->piston_list) glDeleteLists(1, e->piston_list);
- e->piston_list = glGenLists(1);
+ /* if (e->piston_list) glDeleteLists(1, e->piston_list); */
+ if (! e->piston_list) e->piston_list = glGenLists(1);
glNewList(e->piston_list, GL_COMPILE);
glRotatef(90, 0, 0, 1);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, colour);
return polys;
}
-static int display(Engine *e)
+static int display(ModeInfo *mi)
{
+ Engine *e = &engine[MI_SCREEN(mi)];
int polys = 0;
GLfloat zb, yb;
float rightSide;
0.0, 1.0, 0.0);
glPushMatrix();
+# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */
+ {
+ GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi);
+ int o = (int) current_device_rotation();
+ if (o != 0 && o != 180 && o != -180)
+ glScalef (1/h, 1/h, 1/h);
+ }
+# endif
+
glLightfv(GL_LIGHT0, GL_POSITION, lightpos);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_sp);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_sp);
float crankThick = 0.2;
float crankDiam = 0.3;
- if (e->shaft_list) glDeleteLists(1, e->shaft_list);
- e->shaft_list = glGenLists(1);
+ /* if (e->shaft_list) glDeleteLists(1, e->shaft_list); */
+ if (! e->shaft_list) e->shaft_list = glGenLists(1);
glNewList(e->shaft_list, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
glViewport(0,0,(GLint)width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-1.0,1.0,-1.0,1.0,1.5,70.0);
+/* glFrustum(-1.0,1.0,-1.0,1.0,1.5,70.0);*/
+ gluPerspective(40.0,((GLdouble)width)/height,1.5,70.0);
glMatrixMode(GL_MODELVIEW);
e->win_h = height;
e->win_w = width;
int screen = MI_SCREEN(mi);
Engine *e;
- if (engine == NULL) {
- if ((engine = (Engine *) calloc(MI_NUM_SCREENS(mi),
- sizeof(Engine))) == NULL)
- return;
- }
+ MI_INIT(mi, engine, NULL);
e = &engine[screen];
e->window = MI_WINDOW(mi);
glXMakeCurrent(disp, w, *(e->glx_context));
- mi->polygon_count = display(e);
+ mi->polygon_count = display(mi);
glColor3f (1, 1, 0);
if (do_titles)
glXSwapBuffers(disp, w);
}
-ENTRYPOINT void
-release_engine(ModeInfo *mi)
-{
- if (engine != NULL) {
- (void) free((void *) engine);
- engine = NULL;
- }
- FreeAllGL(mi);
-}
-
XSCREENSAVER_MODULE ("Engine", engine)
#endif