# define DEFAULTS "*delay: 20000 \n" \
"*showFPS: False \n"
-# define refresh_stairs 0
# define release_stairs 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
#if 0
#include "e_textures.h"
#else
-#include "xpm-ximage.h"
-#include "../images/wood.xpm"
+#include "ximage-loader.h"
+#include "images/gen/wood_png.h"
#endif
#include "sphere.h"
#ifdef USE_MODULES
ModStruct stairs_description =
{"stairs", "init_stairs", "draw_stairs", NULL,
- "draw_stairs", "change_stairs", NULL, &stairs_opts,
+ "draw_stairs", "change_stairs", "free_stairs", &stairs_opts,
1000, 1, 1, 1, 4, 1.0, "",
"Shows Infinite Stairs, an Escher-like scene", 0, NULL};
reshape_stairs (ModeInfo * mi, int width, int height)
{
stairsstruct *sp = &stairs[MI_SCREEN(mi)];
+ int y = 0;
- glViewport(0, 0, sp->WindW = (GLint) width, sp->WindH = (GLint) height);
+ if (width > height * 5) { /* tiny window: show middle */
+ height = width;
+ y = -height/2;
+ }
+
+ glViewport(0, y, sp->WindW = (GLint) width, sp->WindH = (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0);
check_gl_error("mipmapping");
#else
{
- XImage *img = xpm_to_ximage (mi->dpy,
- mi->xgwa.visual,
- mi->xgwa.colormap,
- wood_texture);
+ XImage *img = image_data_to_ximage (mi->dpy, mi->xgwa.visual,
+ wood_png, sizeof(wood_png));
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
img->width, img->height, 0,
- GL_RGBA,
- /* GL_UNSIGNED_BYTE, */
- GL_UNSIGNED_INT_8_8_8_8_REV,
- img->data);
+ GL_RGBA, GL_UNSIGNED_BYTE, img->data);
check_gl_error("texture");
XDestroyImage (img);
}
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular);
}
-static void free_stairs (ModeInfo * mi);
-
ENTRYPOINT void
init_stairs (ModeInfo * mi)
{
int screen = MI_SCREEN(mi);
stairsstruct *sp;
- MI_INIT (mi, stairs, free_stairs);
+ MI_INIT (mi, stairs);
sp = &stairs[screen];
sp->step = 0.0;
}
#endif /* !STANDALONE */
-static void
+ENTRYPOINT void
free_stairs (ModeInfo * mi)
{
stairsstruct *sp = &stairs[MI_SCREEN(mi)];