PDA

View Full Version : blending / alpha textures



lee
02-05-2001, 03:41 PM
hi - i have a question about textures...i want to make a wing of a bug in opengl. to make it out of polygons and then texture it would be a disaster i think, so i thought that maybe i could take a picture of a wing and use it as a texture on 1 polygon. but since ogl textures are square, how do i code it so that the edges of the texture will be transparent, and i am just left with the picture of the bug-wing?

mango
02-05-2001, 05:25 PM
Edit your picture in a paint program adding an alpha mask. Enable alpha testing in your OpenGL program.

rIO
02-06-2001, 12:13 AM
Mango solution is the "school perfect" solution, IO must admit.
Just want to post antoher way of doing it.
It's also possible to draw the wing with veins and bones on a black background, and then use GL_SRC_COLOR for the glBlendFunc call.
It will give you a transparent texture where it's pixels are darker.
The method depends on how much space you have, Mango's solution is better but u need to store one bitplane more for alpha values.

rIO http://www.spinningkids.org/umine