From http://www.jwz.org/xscreensaver/xscreensaver-5.16.tar.gz
[xscreensaver] / hacks / glx / xlock-gl-utils.c
index d72b4ebdd4aa4ad0d4884893441d05c3e4aecec0..0921731f22eb59d224d1593e431d1f76819fd0f4 100644 (file)
 #include "xlockmoreI.h"
 #include "glxfonts.h"
 
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <GL/glx.h>
-
 #ifndef isupper
 # define isupper(c)  ((c) >= 'A' && (c) <= 'Z')
 #endif
@@ -118,6 +114,21 @@ 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);
+  }
 
   /* GLXContext is already a pointer type.
      Why this function returns a pointer to a pointer, I have no idea...
@@ -129,7 +140,6 @@ init_GL(ModeInfo * mi)
   }
 }
 
-
 \f
 
 /* clear away any lingering error codes */