TGAs???

OK, so here we have an image format which supports an alpha channel, and you have me jumping for joy at the chance to test it out.

how?

I can load the texture with the help of a loader i found, but the whole transparency thing eludes me. What do I have to do?

On nehe.gamedev.net has a good tutor on using the alpha channel.

You will need a good paint program (I use paint shop pro 5), to create a TGA with an alpha channel.

The alpha channel is used as a mask, to map the areas that are to be transparent.

Step one load or create the image you wish to use.

Then use channel split—>HSL
this will create three images based on hue, staturation, luminance.

I find hue image works best for me in creating the mask. The areas that you want to be transparent make black, area to be shown make white.

Then click on your first image, then click on mask–>new—>from image
choose hue as your source, then ok

Now goto mask, choose show mask, make sure that only the areas you want to be trasparent are in the mask.

If it looks good, choose mask—save to alpha channel.

Then save your image as a TGA.

Originally posted by FaTBoyGoD:
[b]OK, so here we have an image format which supports an alpha channel, and you have me jumping for joy at the chance to test it out.

how?

I can load the texture with the help of a loader i found, but the whole transparency thing eludes me. What do I have to do?[/b]

That’s cool. I didn’t know how to do that, so thanks.

So how do you go about getting this transparency into an opengl app. Not the loading if the texture, but hiding the alpha bit?

Cheers.

In a texture image transparentcy is part of the TGA image, it is loaded when the TGA file is loaded.

But in order to control the alpha you do not have to use a texture file.

You can control the alpha channel with glcolor4f( R, G , B , A) A = 0;transparent, A = 0.5 simi-transparent, A = 1; non-transparent

Also turn it on and off with the GL_BLEND function.

nehe.gamedev.net has a good example of this.

Originally posted by FaTBoyGoD:
[b]That’s cool. I didn’t know how to do that, so thanks.

So how do you go about getting this transparency into an opengl app. Not the loading if the texture, but hiding the alpha bit?

Cheers.[/b]

[This message has been edited by nexusone (edited 09-20-2002).]

On my site, I’ve a example for loading TGA with alpha channel…

httl://ibelgique.ifrance.com/Slug-Production/

Dylan: just out of curiosity, do you take the image origin bits into account and flip the image if neccesary?All loaders I’ve seen seem to ignore them which should load some tgas the wrong way(like the ones created with gimp).