Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Alpha on primitives not working as expected?

This thread is locked; no one can reply to it. rss feed Print
Alpha on primitives not working as expected?
jmasterx
Member #11,410
October 2009

Did something with Alpha change in RC4 because when I draw a primitive with for example al_map_rgba(255,255,255,50), it just draws it fully white and does not even consider what is already drawn, so no blending is happening.

Thanks

Matthew Leverton
Supreme Loser
January 1999
avatar

The default blender changed in one of the RCs. Either set it back to what you expect it to be or premultipy your RGB values by your alpha.

In your example rgba(128,128,128,50).

Trent Gamblin
Member #261
April 2000
avatar

Actually they'd be 255*50/255 = 50, not 128.

Matthew Leverton
Supreme Loser
January 1999
avatar

Right. I was thinking 50%.

Mark Oates
Member #1,146
March 2001
avatar

Yes jmaster, blending is different now. You'll need to multiply each color component by the percentage of alpha. It's easier to think of it in floats:

float alpha = 0.5f;
al_map_rgba_f(1.0f*alpha, 0.53f*alpha, 0.8f*alpha, alpha);

Here was my thread on the issue.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Go to: