X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fextrusion.c;h=0f35ffb642371ab47dbd209c6be2dcf0c8822e83;hb=cccbddbc4140cf9a06d7d95cc5c0ca36eb5d6e28;hp=48e57aeb884659aaf881e6d4b594937db7e655a6;hpb=72c1f4c1dc6ab07fe121a327ff1c30bf51ef74c1;p=xscreensaver diff --git a/hacks/glx/extrusion.c b/hacks/glx/extrusion.c index 48e57aeb..0f35ffb6 100644 --- a/hacks/glx/extrusion.c +++ b/hacks/glx/extrusion.c @@ -15,6 +15,7 @@ * Revision History: * Tue Oct 19 22:24:47 PDT 1999 Initial creation by David Konerding + * * * Notes: * This screensaver requires the GLE ("OpenGL Tubing and Extrusion Library") @@ -28,14 +29,19 @@ #include - +#ifdef HAVE_CONFIG_H +#include +#endif #ifdef STANDALONE # define PROGCLASS "Screensaver" # define HACK_INIT init_screensaver # define HACK_DRAW draw_screensaver +# define HACK_RESHAPE reshape_screensaver # define screensaver_opts xlockmore_opts -#define DEFAULTS "*light: True \n" \ +#define DEFAULTS "*delay: 10000 \n" \ + "*showFPS: False \n" \ + "*light: True \n" \ "*wire: False \n" \ "*texture: False \n" \ "*image: BUILTIN \n" \ @@ -49,13 +55,6 @@ #ifdef USE_GL /* whole file */ -#ifdef HAVE_XPM -# include -# ifndef PIXEL_ALREADY_TYPEDEFED -# define PIXEL_ALREADY_TYPEDEFED /* Sigh, Xmu/Drawing.h needs this... */ -# endif -#endif - #ifdef HAVE_XMU # ifndef VMS # include @@ -64,14 +63,18 @@ # endif /* VMS */ #endif -#include +#include #include #include #include #include #include #include +#ifdef HAVE_GLE3 +#include +#else #include +#endif #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) @@ -451,12 +454,24 @@ void Create_Texture(char *filename, int do_mipmap, int do_texture_quality) } if (do_mipmap) { - gluBuild2DMipmaps(GL_TEXTURE_2D, format, width, height, - format, GL_UNSIGNED_BYTE, image); - } - else { + int status; + clear_gl_error(); + status = gluBuild2DMipmaps(GL_TEXTURE_2D, format, width, height, + format, GL_UNSIGNED_BYTE, image); + if (status) + { + const char *s = gluErrorString (status); + fprintf (stderr, "%s: error mipmapping %dx%d texture: %s\n", + progname, width, height, + (s ? s : "(unknown)")); + exit (1); + } + check_gl_error("mipmapping"); + } else { + clear_gl_error(); glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, image); + check_gl_error("texture"); } free(image); } @@ -657,6 +672,7 @@ void draw_screensaver(ModeInfo * mi) dd_lasty *= scale; } + if (mi->fps_p) do_fps (mi); glXSwapBuffers(display, window); } @@ -688,8 +704,8 @@ void resetProjection(void) { } /* Standard reshape function */ -static void -reshape(int width, int height) +void +reshape_screensaver(ModeInfo *mi, int width, int height) { global_width=width; global_height=height; @@ -727,12 +743,13 @@ void chooseScreensaverExample(void) { } /* main OpenGL initialization routine */ -void initializeGL(GLsizei width, GLsizei height) +void +initializeGL(ModeInfo *mi, GLsizei width, GLsizei height) { int style; int mode; - reshape(width, height); + reshape_screensaver(mi, width, height); glViewport( 0, 0, width, height ); glEnable(GL_DEPTH_TEST); @@ -782,8 +799,8 @@ void init_screensaver(ModeInfo * mi) gp->window = MI_WINDOW(mi); if ((gp->glx_context = init_GL(mi)) != NULL) { - reshape(MI_WIDTH(mi), MI_HEIGHT(mi)); - initializeGL(MI_WIDTH(mi), MI_HEIGHT(mi)); + reshape_screensaver(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + initializeGL(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); chooseScreensaverExample(); } else { MI_CLEARWINDOW(mi);