Hello, I’m new to SDL but not to programming. I’ve been reading all about SDL’s alpha blending capabilities for the last couple of days but still have some questions/issues. Most of the information I have found deals with blitting surfaces onto each other and I’m not doing that. I’m using SDL_gfx to draw simple primitives (pixels, circles, lines, rects, etc.). I’m using the alpha aware calls for these SDL_gfx functions.
The big picture is that I want to draw random circles (for example) into the full screen window (with a black background) and I would like to have later drawn circles which overlap previously drawn circles be semi transparent so you can see what they are covering. This functionality will be part of a particle system I’ve been developing.
I’m trying to determine what setup I need to do to make this happen. My questions are:
-
Do I need to set SDL_SRCALPHA during video mode setup ? If so, why?
-
Do I need a call to SDL_SetAlpha on my display surface ? If so, why?
-
If I call SDL_SetAlpha what value for alpha do I need to pass for the window’s surface?
When I call the SDL_gfx function for drawing a circle I pass it a color that was created with SDL_MapRGBA(surface->format, red, green, blue, alpha) with alpha < 255.
Sometimes I get circles without blending, sometimes the screen remains blank and sometimes I see some blending depending upon the various parameters I use. Usually I could use the process of elimination to figure this out but there are so many variables involved there are to many permutations. If I can get a mental picture of how this process should work I can eliminate the guess work.
One final SDL_gfx related questions. When I have seen blending kinda work it seems like the process is iterative. That is it paints the filled circles multiple times. Is this normal ?
Any help you can provide would be appreciated.
Thank You