Well… I dont really know how this is meant to be done because
everything I have tried has never worked but hopefully something in
this code should be coming up translucent.
When I run this on my machine, only the FillRect with the color returned
from MapRGBA is translucent, everything else is 100% opaque (I think
thats the right way of describing it ). I do, however, know very
little about graphics stuff… Anyone have any code example of how to
really blit translucent stuff over a GL screen?
Okay, there are two problems here.
First, the alpha value in SDL_SetAlpha() is ignored when working with RGBA
surfaces, all you can do with the function is affect the blit semantics, as
documented in SDL_video.h next to the entry for SDL_BlitSurface().
Second, there was a bug in the blit code for ARGB -> ARGB surfaces, where
if the source alpha was opaque, the destination alpha was overwritten
instead of preserved. This has been fixed in the ARGB32 -> ARGB32 case,
but Yorick, I suspect that it’s broken for some of the other blitters as
well, can you check it out?
Anyway, grab the latest CVS snapshot and change your first SDL_SetAlpha()
call to:
SDL_FillRect(screen, NULL, SDL_MapRGBA(screen->format, 255, 255, 255, 64));
Then everything should work as expected.
See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software