X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fxlock-gl.c;h=0f313e52946f94f4b2229c0061741723133293c3;hb=ccb7f4903325f92555a9722bba74b58346654ba0;hp=67d9eddffa925237b30a3725d44e5a5564ffba18;hpb=82c5080773aae5e72ec155327c075775e023d2ee;p=xscreensaver diff --git a/hacks/glx/xlock-gl.c b/hacks/glx/xlock-gl.c index 67d9eddf..0f313e52 100644 --- a/hacks/glx/xlock-gl.c +++ b/hacks/glx/xlock-gl.c @@ -1,5 +1,5 @@ /* xlock-gl.c --- xscreensaver compatibility layer for xlockmore GL modules. - * xscreensaver, Copyright (c) 1997, 1998, 1999 Jamie Zawinski + * xscreensaver, Copyright (c) 1997-2002 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 @@ -89,6 +89,28 @@ init_GL(ModeInfo * mi) } } + + /* jwz: the doc for glDrawBuffer says "The initial value is GL_FRONT + for single-buffered contexts, and GL_BACK for double-buffered + contexts." However, I find that this is not always the case, + at least with Mesa 3.4.2 -- sometimes the default seems to be + GL_FRONT even when glGet(GL_DOUBLEBUFFER) is true. So, let's + make sure. + + Oh, hmm -- maybe this only happens when we are re-using the + xscreensaver window, and the previous GL hack happened to die with + the other buffer selected? I'm not sure. Anyway, this fixes it. + */ + { + GLboolean d = False; + glGetBooleanv (GL_DOUBLEBUFFER, &d); + if (d) + glDrawBuffer (GL_BACK); + else + glDrawBuffer (GL_FRONT); + } + + /* GLXContext is already a pointer type. Why this function returns a pointer to a pointer, I have no idea... */