I searched a bit and played with various calls to al_set_blender and al_set_separate_blender, but now I'm pretty sure this is an Allegro bug or oversight.
What I'm trying to do is port some existing XNA code over to Allegro, and part of that involves drawing an image using additive blending, but at 50% opacity. As far as I can tell, Allegro should be capable of this if I use al_set_blender and al_draw_tinted_bitmap, but it doesn't work as expected.
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); al_draw_tinted_bitmap(current_buffer, al_map_rgba_f(1, 1, 1, 0.5f), 0, 0, 0);
Even if I change the 0.5f to 0, it will still be drawn at 100% opacity. The red, green, and blue values work as expected with additive blending, but not alpha.
I'm using Allegro 5.0.9.
Use the default blender (don't call al_set_blender).
I do this all the time (exactly the way you described) but I use ALLEGRO_ALPHA and ALLEGRO_INVERSE_ALPHA.
al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA);
Try it with ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA.
Use the default blender (don't call al_set_blender).
If I do that, it's not drawn using additive blending...
I do this all the time (exactly the way you described) but I use ALLEGRO_ALPHA and ALLEGRO_INVERSE_ALPHA.
Try it with ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA.
I tried this, but it doesn't give the desired effect.
{"name":"607330","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/2\/a2de032033c4340b3980591b20152f57.png","w":960,"h":303,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/2\/a2de032033c4340b3980591b20152f57"}
The original is drawn first, then the glow is drawn on top of it using an additive blender and at 50% opacity. The third picture should be the same as the second picture, but Allegro isn't doing anything with the alpha channel. Even if it's zero, it'll still look like the third picture.
Show code 'cuz you're doing it wrong.
EDIT: nvm, you showed enough code. Allegro uses premultiplied alpha, so your color should be al_map_rgba_f(color.r*a, color.g*a, color.b*a, a).
Argh, why didn't I think of that?! Using additive blending, doing that is exactly the same as changing the alpha! I guess I was looking at it for too long.
Thanks for the fix, it now looks almost exactly the same as my XNA implementation!
*gives cookies*