Alpha on primitives not working as expected?
jmasterx

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

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

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

Matthew Leverton

Right. I was thinking 50%.

Mark Oates

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.

Thread #606149. Printed from Allegro.cc