[SDL] color key broken in glSDL?
James Gregory
james.jrg at gmail.com
Fri Oct 13 04:32:46 PDT 2006
On 10/13/06, David Olofson <david at olofson.net> wrote:
> Why are you using colorkey on RGBA surfaces in the first place?
> AFAICT, you can't run into this problem without doing something
> backwards. When you're using RGB color values with RGBA pixels,
> you're basically comparing apples to pears.
>
> glSDL will generate RGBA surfaces when you (gl)SDL_DisplayFormat()
> colorkeyed surfaces, because that's how it implements colorkeying
> over OpenGL. (This is indeed a side effect that other backends don't
> have, AFAIK. They're almost the other way around; they accelerate
> colorkeying, but not alpha.)
>
> If you mess with the colorkey settings of display format converted
> surfaces, the display formatting is essentially undone, and glSDL
> will have to do on-the-fly conversion for every blit afterwards. When
> doing so, it'll implement the new colorkey settings over the
> proviously RGBA-converted surface by attempting to key it into a new
> RGBA surface.
>
I ran into this problem doing this (pseudo code):
surface1 = load_image();
image_processing(surface1);
surface2 = create_rgba_surface();
blit(from surface1, to surface2);
set_color_key(surface2);
display_format(surface2);
I could remove the blitting across step, but then I would need to
reload the image each time I want to do some processing and create a
surface from it.
James
More information about the SDL
mailing list