PDA

View Full Version : Alpha-Texture?



TorbenKeil
02-27-2001, 08:18 AM
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

zed
02-27-2001, 10:14 AM
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.

TorbenKeil
02-27-2001, 11:53 AM
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

Moz
02-27-2001, 04:12 PM
Targa bitmaps can store the alpha channel.

02-27-2001, 05:47 PM
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... http://www.opengl.org/discussion_boards/ubb/wink.gif :P

Elixer
02-27-2001, 09:45 PM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

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

Deiussum
02-28-2001, 09:23 AM
You can also get a port of the Gimp for Win32. (Check www.cygwin.com, (http://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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Deiussum
02-28-2001, 09:27 AM
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)

TorbenKeil
02-28-2001, 11:40 PM
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...

zed
03-01-2001, 01:43 AM
i recommend te www.openil.org (http://www.openil.org) library it simplifies the loading of most image formats tga,jpg,png etc