I can't get them to work. Here's the code I'm using to create the alpha maps:
void RandomAlphaMap()
{
#define szm 32
GLubyte map[szm*szm];
char v = (rand()%255);
for(int x=0;x<szm;x++)
for(int y=0;y<szm;y++)
alphamap[y*szm+x] = (rand()%255);
glActiveTextureARB(GL_TEXTURE1_ARB);
glGenTextures(1,(GLuint*)↦_tex);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glBindTexture(GL_TEXTURE_2D,map_tex);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D,4,szm,szm,GL_ALPHA,GL_UNSIGNED_BYTE,data);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
}
I'm expecting random alpha distribution, but what I'm getting is solid alpha when using the alpha map:
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,some_tex);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,map_tex);
//draw geometry
Anybody see anything wrong or something I might be forgetting?
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared