[SDL] SDL_SetGamma not fully black at 0.0

Matthew Parker mparker at cse.unr.edu
Mon Dec 3 22:33:38 PST 2007


I'm trying to use SDL_SetGamma to make my desktop flicker to complete 
black at random intervals.  (I find it to be relaxing on my eyes).

I can get it working if I open up a window using SDL_SetVideoMode first, 
then call SDL_SetGamma(0.0, 0.0, 0.0).  The screen does go completely 
black just like I want.  The problem with this is that when my SDL window 
loses focus it stops doing the flickering (usually).  I'm using X11, and 
it only 
stops flickering whenever I put the focus on an X11 application (focusing 
on a terminal doesn't stop it for some reason).

I can also get SDL_SetGamma to set the gamma without loading a window 
first; just by calling SDL_Init to initialize the video.  This has the 
advantage that it doesn't open a windown, so it can't lose focus, so it 
keeps flickering, whatever application I open.  However, even though I 
call SDL_SetGamma(0.0, 0.0, 0.0), the screen doesn't go completely black, 
but is actually, I think, at 0.1, 0.1, 0.1.  I think this because 
when using 
the command-line tool "xgamma", 0.1 is the minimum gamma value.

Is there some trick I can do, either with the window, or without, that 
will get the gamma to actually go to 0.0, and keep flickering in the 
background even after I select other windows?

Thank you, I've spent several forlorn hours trying to figure this out.

Matt



More information about the SDL mailing list