PDA

View Full Version : Colorkeying!



kaysoft
11-13-2002, 05:23 AM
Is there a way to use colorkeying in opengl? For example, I have an image that is loaded with DevIL (i know its data), and I want the black color to be transparent. How do i do that??

Bob
11-13-2002, 06:49 AM
First allocate a new image with room for all color components in the original image plus an alpha channel. Copy each pixel from the old image to the new, and set the alpha channel to either one or zero, depending on the color. If black, set it to zero. Then use alpha test to reject pxiels with alpha other than one, that is, black pixels.

kaysoft
11-13-2002, 07:18 AM
Thanks a lot!