Texture mapping with alpha channel on

Hi,
I’m writing my own C++ class to print text on the screen using texture mapped quads.
I’d like to get rid of the background color of the texture (black), so that I can draw text transparently. Then I need to turn on blending.
Now, how can I create a 32 bit depth texture ?
Can I do it with Photoshop ?

Almost every image tool that supports masks can write them as an alphachannel to a fileformat that supports it (like TGA, PNG).
And yes, you can create masks in Photoshop too and it can also save them as the alphachannel into TGA or PNG (or other formats).

Thanks, I’ll try it !

Another approach would be to blend your text with glBlendFunc (GL_ONE, GL_ONE) (i think).
This way you “add” your text to the scene. But since adding 0 to something doesn´t change anything, only your text (white, blue, green, whatever you want, except black) will show up. The black background of the text won´t show up.
This is much easier than adding a 4th channel to your text-texture. And the edges of the text will be smoother.

BTW: On Nehe´s page under “Downloads” you can get the “Bitmap Font Builder”. It´s a nice tool to create bitmap fonts:
http://nehe.gamedev.net/data/downloads/download.asp?letter=B

Bye,
Jan.

That only works for white text, ot it will become a bit transparent. ( since pure blue + red will become magenta, if font = blue and background for that pixel is red)

If you want single colored characters you can minimize the memoryusage by using a pure alpha map, and then set the color of the char with glColor3f(), texenv to GL_REPLACE, and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

or if you want multicolored chars you must use an RGBA map if you dont want the char transparent in any way.

And for a character builder that are a bit more flexible i suggest mine http://mazy.annat.nu/fonture

I’d also prefer Alphamasking, even if the borders of the chars won’t be as smooth as if you’d use bleding, but blending eats much more fillrate then alphamasking, so that it would be a lot slower to draw a bigger text with blending than with alphamasking.

Thanks you all.
Can you help me create a 32bit-depth alpha bitmap ?
I can’t create it with Photoshop, please provide some web link where I can find any tips…

Take a look at the helpfile that comes with photoshop.It tells you exactly how to create a mask, and then save it to TGA as a 32Bit image.