Problem with SDL_SetGammaRamp on SDL 1.2.14 on Windows

Greetings,

I’m posting this on behalf of a colleague. I’ve investigated it a
bit myself, so I’ll add additional comments below.

The problem we’re experiencing:

Recently we started using libSDL 1.2.14 because it solved problems with
audio playback for WAV files that had non-ascii pathnames (UTF-8
support) but we now realize that the switch broke the SDL_SetGammaRamp()
functionality we depend on elsewhere in our application. If we revert
back to the old SDL.dll (version 1.2.9) then the gamma fading in our
slideshow works fine again.

We create our video like so:

m_screen = SDL_SetVideoMode(scr_w, scr_h, scr_bpp,
                            SDL_FULLSCREEN|SDL_SWSURFACE);

The problem isn’t that gamma changes don’t work at all–they do work
somewhat. When we fade to black, the screen goes about half way to
black, and then when we transition back to full brightness it works
fine. We just can’t fade entirely to black with the 1.2.14 version.

Any ideas as to why we can’t fade gamma completely to black?

I’ve verified this on my Win-7 64bit system. With the SDL 1.2.9 DLL,
the gamma fades completely to black. Swapping in the 1.2.14 DLL, the
gamma fade indeed stops about “half way” to black.

For what it’s worth, I’ve seen this sort of “half way” gamma fade
behavior on windows previously, when I omit the SDL_FULLSCREEN flag
on SDL_SetVideoMode().

I attempted to clone the SDL-1.2 repository from hg, to explore
what may have changed in the implementation of SDL_SetGammaRamp
and/or SDL_SetVideoMode between 1.2.9 and 1.2.14, however I’m
experiencing the following error from hg:

$ hg clone -u SDL-1.2 http://hg.libsdl.org/SDL SDL-1.2
requesting all changes
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
abort: premature EOF reading chunk (got 15386565 bytes, expected 44126300)

If anyone has any thoughts on any of the above, thanks for your help!

Regards,

Bill

windib, the default driver in SDL 1.2.14, doesn’t allow you to set the
gamma ramp dark enough to black the screen. This is a Windows API
limitation.

In SDL 1.2.9 the default video driver was directx, which (fullscreen
only) will let you completely black the screen.

You can change video drivers using the environment variable, but I’ve
not had much success with the directx driver in Vista and 7. We’re
doing fade in/out in software or OpenGL now.

GregoryOn Fri, Jan 21, 2011 at 9:36 PM, Bill Kelly wrote:

Greetings,

I’m posting this on behalf of a colleague. ?I’ve investigated it a
bit myself, so I’ll add additional comments below.

The problem we’re experiencing:

Recently we started using libSDL 1.2.14 because it solved problems with
audio playback for WAV files that had non-ascii pathnames (UTF-8
support) but we now realize that the switch broke the SDL_SetGammaRamp()
functionality we depend on elsewhere in our application. ?If we revert
back to the old SDL.dll (version 1.2.9) then the gamma fading in our
slideshow works fine again.

We create our video like so:

? ? m_screen = SDL_SetVideoMode(scr_w, scr_h, scr_bpp,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SDL_FULLSCREEN|SDL_SWSURFACE);

The problem isn’t that gamma changes don’t work at all–they do work
somewhat. ?When we fade to black, the screen goes about half way to
black, and then when we transition back to full brightness it works
fine. ?We just can’t fade entirely to black with the 1.2.14 version.

Any ideas as to why we can’t fade gamma completely to black?

I’ve verified this on my Win-7 64bit system. ?With the SDL 1.2.9 DLL,
the gamma fades completely to black. ?Swapping in the 1.2.14 DLL, the
gamma fade indeed stops about “half way” to black.

the issue with the HG repository is known, and Sam has contacted someone to fix it.
Try the snapshot from the site’s download page instead. It’s probably the exact same code.

as for the actual SDL bug; that is a mystery to me.------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/