Alpha-Texture?

Hi,

I need your help,
I’m searchng for a possebility to draw a texture where a color have to represent a invisible area.

  • like when I want to draw a bush, I print 2 rectangles and show on these rectangules only the branches and the rest of the textures havent to be shown.

How can I realize this?

Thanks,

Torben

load in the RGB texture and for each pixel check if its colour is black if so set the pixels alpha value to 0 if not set it to 1
use glTexImage2D(…) with the modified texture data (it now has a alpha channel)

and use
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0 );

easier still is to make in some paint program the alpha’s 0 of the pixels u dont wanna see and save the textures as a RGBA image.

Thankyou for that tip.
Can I paint RGBA-Textures with Photoshop?
I know that you can work with layers, but how can I save such a picture with Alpha-values?

Torben

Targa bitmaps can store the alpha channel.

How do you get the alpha channel out of a seperate texture? That would be easier for me to handle cuz I don’t have any money, nor a program that can decently store an alpha channel. I have yet to try Ulead PhotoImpact6 in this respect though. I hope it can… I hope it can… :stuck_out_tongue:

You can make your own if you want. Just use any image, and do a grayscale on it. This limits colors to 256, which is what is stored in alpha channel.

You could also try paint shop pro, or any program that uses targa image files.

You can also get a port of the Gimp for Win32. (Check www.cygwin.com, there’s a link to it somewhere there.) It does a lot of similar things to what you can do in Photoshop, but it’s free. The one thing I don’t like about it is that it doesn’t exactly have a standard Windows UI, which is understandable since it was written for UNIX/Linux. Still… it gets to be annoying.

TorbenKeil - To get an alpha channel in Photoshop go to the “Channels” panel. It should be one of the tabs in the “Layers” panel, if I recall right. Click the button on the bottom for “new channel” and you’ll get an alpha channel. Click on that channel to write to it. (Grayscale only for that channel)

Thank you all…

Okay, if I understood right, I have to paint with photoshop and then enable the alpha-values?
And then on the Alpha-channel I can ‘draw’ the alpha-values in 8 Bit Greyscale.
Okay, then I have to save it as targa and load it somehow into my OpenGL-program.
But how? Nehe’s tutorials only load normal BMPs…
Help me again…

i recommend te www.openil.org library it simplifies the loading of most image formats tga,jpg,png etc