GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


Alpha Textures by DELTRON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
/*

BMP's have no alpha channel.  You must load in the bmp data and its other
 information somewhere and "expose" the data to opengl when building
 the texture object.

When you build the RGB texture with opengl, it is JUST THAT, an RGB
 texture. (r,g,b,0)

glBlendFunc(GL_SRC_ALPHA, GL_ONE) is the typical blending function set
when using bmp's.  It will act as if it has an alpha channel against the color
black, but with other colors already present in the framebuffer it will 'add'.
This is often a desired effect in particle systems and so it may be confused
by some people.

Without an alpha channel you would have to use a texture mask to get the
same results.

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) is the standard
blending function for an object that has an alpha channel.

- Delt.  Date: (a long time ago)

*/

// Example source:  http://deltronslair.com/alpha.zip