SDL_OPENGLBLIT + SDL_SetGamma() bug

With SDL 1.2.7, if one specifies SDL_OPENGLBLIT to SDL_SetVideoMode(),
SDL_SetGamma() breaks – (on my system, I guess the best way to
describe the bug would be “black values become red as I increase gamma
from 0 to 1 for R, G, and B”).

My system:
SDL 1.2.7
xorg 6.7.0-9 (Fedora Core 2) in 24 bit depth
Radeon 9200

This is currently visible in the title-screen gamma fading in the SDL
port of Aleph One, the open-source Marathon project.

I’ve prepared and attached a patch for SDLgears 1.0.2 that causes
SDLgears to demonstrate the bug – the patch should (if everything was
working properly) cause the screen to fade from black to white as the
gears are spinning.

Note that one can make the patched SDLgears 1.0.2 work properly (with
gamma fading) by simply changing SDL_OPENGLBLIT to SDL_OPENGL.–
Best of luck,
Mark Schreiber
-------------- next part --------------
— SDLgears.c 2000-07-24 16:52:59.000000000 -0400
+++ /home/schreib1/tmp/sdl_gamma/SDLgears-1.0.2/SDLgears.c 2004-10-29 19:45:24.531323905 -0400
@@ -304,7 +304,7 @@

SDL_Init(SDL_INIT_VIDEO);

  • screen = SDL_SetVideoMode(300, 300, 16, SDL_OPENGL|SDL_RESIZABLE);
  • screen = SDL_SetVideoMode(300, 300, 16, SDL_OPENGLBLIT|SDL_RESIZABLE);
    if ( ! screen ) {
    fprintf(stderr, “Couldn’t set 300x300 GL video mode: %s\n”, SDL_GetError());
    SDL_Quit();
    @@ -361,6 +361,17 @@
    }
    }

  • {

  •   float val;
    
  •   Uint32 tim;
    
  •   tim = SDL_GetTicks();
    
  •   val = ((tim / 5) % 1000) / 1000.0;
    
  •   printf("val: %p %d %f\n", screen, tim, val);
    
  •   SDL_SetGamma(val, val, val);
    
  • }
    draw();
    }
    SDL_Quit();
    -------------- next part --------------
    A non-text attachment was scrubbed…
    Name: not available
    Type: application/pgp-signature
    Size: 189 bytes
    Desc: not available
    URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041029/60a5cd8b/attachment.pgp

Mark Schreiber wrote:

With SDL 1.2.7, if one specifies SDL_OPENGLBLIT to SDL_SetVideoMode(),
SDL_SetGamma() breaks – (on my system, I guess the best way to
describe the bug would be “black values become red as I increase gamma
from 0 to 1 for R, G, and B”).

My system:
SDL 1.2.7
xorg 6.7.0-9 (Fedora Core 2) in 24 bit depth
Radeon 9200

This is currently visible in the title-screen gamma fading in the SDL
port of Aleph One, the open-source Marathon project.

I’ve prepared and attached a patch for SDLgears 1.0.2 that causes
SDLgears to demonstrate the bug – the patch should (if everything was
working properly) cause the screen to fade from black to white as the
gears are spinning.

Note that one can make the patched SDLgears 1.0.2 work properly (with
gamma fading) by simply changing SDL_OPENGLBLIT to SDL_OPENGL.

Yes. SDL_OPENGLBLIT is full of problems/bugs but it is also deprecated.
So don’t use it.

Stephane