Bitmaps and Partial Transparency

I want to display a square bitmap over my scene with only the background of the bitmap to be rendered transparent and the rest of it to be opaque. I want to achieve an effect that is kind of like sprites from older games. Does anyone know how to make only part of a bitmap transparent?

Add an alpha channel to your image, and set the alpha value of each pixel according to the color of the pixel. If your background is white, then set alpha value of all white pixels in your image to zero, all other to one. Then use alpha test to reject pixels with an alpha value of zero.

Thanks for the tip. I understand the concept now but I don’t know exactly what to do to get the alpha channel in the image. I’ve got a pointer to the bitmap in memory by using this function:

function TfrmGL.ReadBitmap(const FilePath:string;var sWidth,tHeight:GLsizei): pointer;
const
szh=SizeOf(TBitmapFileHeader);
szi=SizeOf(TBitmapInfoHeader);
var
bmpfile: file;
bfh: TBitmapFileHeader;
bmi: TBitmapInfoHeader;
t: byte;
x,
size: integer;
begin
assignFile(bmpfile,FilePath);
reset(bmpfile,1);
size := FileSize(bmpfile)-szh-szi;
blockread(bmpfile,bfh,szh);
if Bfh.bfType<>$4D42 then
raise EInvalidGraphic.Create(‘Invalid Bitmap’);
blockread(bmpfile,bmi,szi);
with bmi do
begin
sWidth := biWidth;
tHeight := biHeight;
end;
getmem(result,size);
blockread(bmpfile,result^,size);
for x := 0 to sWidth*tHeight-1 do
with TWrap(result^)[x] do
begin
t := r;
r := b;
b := t;
end;
end;

Then I do the blend like this:

glDisable(GL_DEPTH_TEST);
glTexImage2D(GL_TEXTURE_2D,Level,ColorComps,aW,aH,Border,
GL_RGB,GL_UNSIGNED_BYTE,aWrapper);
glEnable(GL_BLEND);
glBlendFunc(gl_zero, gl_alpha_test);

Where does the alpha go?