1 Load an image, This image can a bmp.
load it into an 4 bit array to include the alpha channel.
so you have
R,G,B,A, R,G,B,A, R,G,B,A, R,G,B,A, ...
GLubyte Data[4*SizeX*SizeY];
now scan the array for a specific color and make its Alpha 0 and the rest to Alpha 255.
for (int x=0; x < SizeX*SizeY; x+=4){Data[x+3]=255;if (Data[x]==0)if (Data[x+1]==0)if (Data[x+2]==0)Data[x+3]=0}
Make this into a texture. useing glTexImage2D
Then when you are ready to draw it do this,
glEnable(GL_ALPHA_TEST); // turns on the alpha testglAlphaFunc(GL_GREATER,0.5f); // Only renders pixels with alpha above 0.5f - in our case its either 1/0 so this will work fine.glBindTexture(GL_TEXTURE_2D,Texture); // Bind your texturedrawthing();// Draw your shape, object, char, thing whateverglDisable(GL_ALPHA_TEST); // disable alpha test
[edited by - Xero-X2 on June 3, 2003 2:16:57 PM]