Make one spec. color appear as Transparent

First of all I just want to say: I’m not sure this topic belongs here on the adv. section, if It doesn’t, forgive me, but plz answer my question anyway.

Well, this is what I want!
When loading a bitmap, and just blitting it to the screen, using standard Windows API, there’s a command called TransparentBlit() “or something like that” That allows the programmer to set one specific color which will be interpreted as transparent. Is it possible to do someting similar in opengl programming and if it is, how is it done?

One guy told me I should use blending, but I can’t figure out how to accomplish my goal with that.

And do not tell me to read the RedBook… I’m not in the mood for that rigth now.

/Thx Dingo

Hi

In 3D APIs you normaly have BItmaps with an Alpha channel. That means you don’t have an image where each pixel consists of Red Green and Blue, you have an pixel with Red Green Blue and Alpha.
With this alpha channel you can say how transparent a pixel should be. The simplest of using the alpha channel is with alpha test. This tests, if your actual pixel has an specific alpha value (or is less then or greater or…) and then discards that when drawing.

So you need to extend your texture with an alpha channel and enable the alpha testing (glEnable(GL_TEST_ALPHA)). To set the alpha test function there is a method i think it is called glAlphaFunc(…), you might have to look this up somewhere .

Lars

b.
[/b]

Almost right
glEnable(GL_ALPHA_TEST);
And, for blending with alpha (e.g. blending 2 textures together) I usually use glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);

Try that, it should work.

Not in the mood to read the Red Book? That’s blasphemy!! You should be banned from the board for saying that!

Seriously, though. There’s a chapter in the Red Book that goes over blending pretty well.