View Full Version : Alpha Blending

10-07-2003, 10:05 AM
I want to know what exactly the alpha is. Is it the color of the transparency or the value of the transparency level.

For example:

GLubyte RGBA[1][1][4] =
{ { {255}, {255}, {255}, {255} } };

If I do this as oppose to this:

GLubyte RGBA[1][1][4] =
{ { {255}, {255}, {255}, {128} } };

Would the first example but full color white or would the white by transparent or would the second example be kind of like a window. You can tell that it is there but you can still see through it.

There may be a problem with the array but this is theory. I do know that I would have to enable GL_BLENDING before I work with this but I hope to understand the alpha before I start working with PNG files or if I don't, be able to create better arrays so that my game would work better.

10-07-2003, 12:22 PM
The alpha value shows the tranparency. An alpha value of 255 in your example would be full white and the one with 128 half white and half mixed with the color behind it (half transparent). alpha of 0 is fully transparent.
Usually you use floats within the range 0..1 for alpha, but of course you can also use a bytes.


10-07-2003, 01:53 PM
The alpha value is just an extra value that goes with each color, which can be used various ways in blending.

Depending on your blending function, the alpha value is used in different ways to blend one color on top of another.