PDA

View Full Version : what's the use of the alpha value of a texture



pango
01-14-2004, 08:28 PM
we know when a texture has 4 color components,the last one is alpha,but what's the use of it?which objects will be affected by it?OGL how to deal it in a blend operation?

gunslinger
01-14-2004, 11:18 PM
hi pango,
the alpha channel of the texture works as the alpha for the colors:
textures' pixels with lower alpha will be more and more transparent. U can use such properties to achive some effects, as the billboarding. (never seen in games those 2d trees always facing the camera? the tree's texture is square, but the higher part is usually transparent.)
Sorry for my poor didactic propoerties, if u wanna know more google yourself searching billboarding http://www.opengl.org/discussion_boards/ubb/smile.gif

Azazel
01-15-2004, 12:27 AM
Shalom! You are just continuing my topic... Yes, that is true - alpha channel is a way to make sprites. Also, if your texture is only RGB you cannot make it transparent - even with similar transparency by whole area. Have you tried to make water? http://www.opengl.org/discussion_boards/ubb/smile.gif So, RGBA textures are rather cool thing. But not in OpenGL at least not on PC. When you will get real sprite, please reply to my topic - Transparent Textures

01-21-2004, 11:11 AM
Actually, you can have the transparency with RGB bmps. But, you have to convert them to RGBA in the loading of the texture.
Just make a new char array [width by height by 4] then go through each pixel and set the 4th value to 0 if its the right color, then send off that char to glTexImage2D.