X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fxlock-gl-utils.c;h=b7b977e59034e74ed5440f0e02035f60a941b3b8;hb=d1ae2829ff0fd2a96c16a0c8c5420efaa47d7b30;hp=eb266f8a5c5e125b23b443d301541b72735408bc;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/glx/xlock-gl-utils.c b/hacks/glx/xlock-gl-utils.c index eb266f8a..b7b977e5 100644 --- a/hacks/glx/xlock-gl-utils.c +++ b/hacks/glx/xlock-gl-utils.c @@ -1,5 +1,5 @@ /* xlock-gl.c --- xscreensaver compatibility layer for xlockmore GL modules. - * xscreensaver, Copyright (c) 1997-2002, 2006 Jamie Zawinski + * xscreensaver, Copyright (c) 1997-2015 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -16,10 +16,7 @@ #include #include "xlockmoreI.h" - -#include -#include -#include +#include "texfont.h" #ifndef isupper # define isupper(c) ((c) >= 'A' && (c) <= 'Z') @@ -59,6 +56,10 @@ init_GL(ModeInfo * mi) XVisualInfo vi_in, *vi_out; int out_count; +# ifdef HAVE_JWZGLES + jwzgles_reset(); +# endif + vi_in.screen = screen_number (screen); vi_in.visualid = XVisualIDFromVisual (visual); vi_out = XGetVisualInfo (dpy, VisualScreenMask|VisualIDMask, @@ -117,6 +118,23 @@ init_GL(ModeInfo * mi) glDrawBuffer (GL_FRONT); } + /* Sometimes glDrawBuffer() throws "invalid op". Dunno why. Ignore. */ + clear_gl_error (); + + /* Process the -background argument. */ + { + char *s = get_string_resource(mi->dpy, "background", "Background"); + XColor c = { 0, }; + if (! XParseColor (dpy, mi->xgwa.colormap, s, &c)) + fprintf (stderr, "%s: can't parse color %s; using black.\n", + progname, s); + glClearColor (c.red / 65535.0, + c.green / 65535.0, + c.blue / 65535.0, + 1.0); + } + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* GLXContext is already a pointer type. Why this function returns a pointer to a pointer, I have no idea... @@ -128,7 +146,6 @@ init_GL(ModeInfo * mi) } } - /* clear away any lingering error codes */ @@ -154,6 +171,11 @@ check_gl_error (const char *type) case GL_STACK_OVERFLOW: e = "stack overflow"; break; case GL_STACK_UNDERFLOW: e = "stack underflow"; break; case GL_OUT_OF_MEMORY: e = "out of memory"; break; +#ifdef GL_INVALID_FRAMEBUFFER_OPERATION + case GL_INVALID_FRAMEBUFFER_OPERATION: + e = "invalid framebuffer operation"; + break; +#endif #ifdef GL_TABLE_TOO_LARGE_EXT case GL_TABLE_TOO_LARGE_EXT: e = "table too large"; break; #endif