X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fstarwars.c;h=69b1cf9cd073c83569e92a2081cc5a0c95c727df;hb=5f9c47ca98dd43d8f59b7c27d3fde6edfde4fe21;hp=118d5d48e4749fe2802ee4562ba477c9719d3be8;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/glx/starwars.c b/hacks/glx/starwars.c index 118d5d48..69b1cf9c 100644 --- a/hacks/glx/starwars.c +++ b/hacks/glx/starwars.c @@ -1,5 +1,4 @@ -/* - * starwars, Copyright (c) 1998-2006 Jamie Zawinski and +/* starwars, Copyright (c) 1998-2011 Jamie Zawinski and * Claudio Matsuoka * * Permission to use, copy, modify, distribute, and sell this software and its @@ -37,10 +36,6 @@ # include #endif -#ifdef HAVE_UNAME -# include -#endif /* HAVE_UNAME */ - #ifndef HAVE_COCOA # include #endif @@ -60,15 +55,23 @@ #ifdef USE_GL /* whole file */ +/* Should be in */ +# ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT +# define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +# endif +# ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT +# define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +# endif + #define DEF_PROGRAM "xscreensaver-text --cols 0" /* don't wrap */ #define DEF_LINES "125" #define DEF_STEPS "35" #define DEF_SPIN "0.03" -#define DEF_FONT_SIZE "-1" +#define DEF_SIZE "-1" #define DEF_COLUMNS "-1" -#define DEF_WRAP "True" -#define DEF_ALIGN "Center" +#define DEF_LINE_WRAP "True" +#define DEF_ALIGNMENT "Center" #define DEF_SMOOTH "True" #define DEF_THICK "True" #define DEF_FADE "True" @@ -150,7 +153,7 @@ static XrmOptionDescRec opts[] = { {"-lines", ".lines", XrmoptionSepArg, 0 }, {"-steps", ".steps", XrmoptionSepArg, 0 }, {"-spin", ".spin", XrmoptionSepArg, 0 }, - {"-size", ".fontSize", XrmoptionSepArg, 0 }, + {"-size", ".size", XrmoptionSepArg, 0 }, {"-columns", ".columns", XrmoptionSepArg, 0 }, /*{"-font", ".font", XrmoptionSepArg, 0 },*/ {"-fade", ".fade", XrmoptionNoArg, "True" }, @@ -176,10 +179,10 @@ static argtype vars[] = { {&max_lines, "lines", "Integer", DEF_LINES, t_Int}, {&scroll_steps, "steps", "Integer", DEF_STEPS, t_Int}, {&star_spin, "spin", "Float", DEF_SPIN, t_Float}, - {&font_size, "fontSize", "Float", DEF_FONT_SIZE, t_Float}, + {&font_size, "size", "Float", DEF_SIZE, t_Float}, {&target_columns, "columns", "Integer", DEF_COLUMNS, t_Int}, - {&wrap_p, "lineWrap", "Boolean", DEF_WRAP, t_Bool}, - {&alignment_str, "alignment", "Alignment", DEF_ALIGN, t_String}, + {&wrap_p, "lineWrap", "Boolean", DEF_LINE_WRAP, t_Bool}, + {&alignment_str, "alignment", "Alignment", DEF_ALIGNMENT, t_String}, {&smooth_p, "smooth", "Boolean", DEF_SMOOTH, t_Bool}, {&thick_p, "thick", "Boolean", DEF_THICK, t_Bool}, {&fade_p, "fade", "Boolean", DEF_FADE, t_Bool}, @@ -789,6 +792,8 @@ init_sws (ModeInfo *mi) if ((sc->glx_context = init_GL(mi)) != NULL) { gl_init(mi); reshape_sws (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + clear_gl_error(); /* WTF? sometimes "invalid op" from glViewport! */ + init_stars (mi, MI_WIDTH(mi), MI_HEIGHT(mi)); } @@ -804,16 +809,21 @@ init_sws (ModeInfo *mi) check_gl_error ("loading font"); -# ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT /* "Anistropic filtering helps for quadrilateral-angled textures. A sharper image is accomplished by interpolating and filtering multiple samples from one or more mipmaps to better approximate very distorted textures. This is the next level of filtering after trilinear filtering." */ - if (smooth_p) - glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); - clear_gl_error(); -# endif + if (smooth_p && + strstr ((char *) glGetString(GL_EXTENSIONS), + "GL_EXT_texture_filter_anisotropic")) + { + GLfloat anisotropic = 0.0; + glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &anisotropic); + if (anisotropic >= 1.0) + glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, + anisotropic); + } } else {