How to treat RGB as transparent ?

I have two textures

Texture 1 : 8 bit luminance
Texture 2 : 16 bit (R5 G5 B5 A1)

and i want to combine ( merge ) these, treating a particular color ( RGB ) in texture 2 as transparent.

What is the fastest way of doing this ?
I am using XP with Nvidia Quadro Fx 1300 chip.

Alpha blending is not very much helpful here. Please have a look at my actual problem :

My actual problem is : I have an image ( texture 1 ) and I have meory DC on which I draw some graphics using Windows GDI calls. I can’t set the alpha values of the pixels on which GDI graphics is drawn because it is not supported in GDI. So i have restricted the RGB(0,0,0) as transparent color and it fill the DC with RGB(0,0,0) before drawing any graphics. Now I want to put this memory DC into texture 2 and merge with texture 1 so that i get an image with GDI graphics drawn on it.

I want to know what is the fastest way of doing it ? Shader program ?

I heard that chroma keying and shader programs can be helpful here but i dont have much idea abt them.

If both the texture are of same format ( 16 bit) will it make any improvement in performance ?

Thanks in advance,
MSB

The simplest way would be to drawpixels with the first one, enable blending and set blendfunc to source_alpha, 1-source_alpha, then drawpixels with the second image.

Your blended image will appear in the framebuffer.

There are other things you could do like create textures and draw polygons using the above blend setup or you could do this in one pass with multitexture, it depends a lot on what you want to do with this.

P.S. please post to the beginners forum for simple questions like this (moving this thread there)

P.P.S.

Please don’t crosspost.