Blend Out Color
Is there a way to specify a certain color to alpha out?
For example, if I have a sprite sheet and the background color is pink, how do I draw a section of that sprite sheet so that the pink does not appear when it draws but other objects that may be behind that object will be visible where the pink would have been?
For example, if I have a sprite sheet and the background color is pink, how do I draw a section of that sprite sheet so that the pink does not appear when it draws but other objects that may be behind that object will be visible where the pink would have been?
You'll have to convert the pink color key to an alpha channel. OpenGL does not support color keying. Probably easier not to do this at load time. Most image editing programs have tools to help you do this.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
That's pretty much what I am gathering from my research. Basically, the best thing is to have an alpha channel as the background. If I don't have alpha as the background, I'll have to manually compare the bits in the image to the key color and set them to black alpha if they match. Am I correct?
That's one way to do it, but is there any reason you can't put a proper alpha channel in the image in the first place?
Yes, it is always possible that I can't get a proper alpha channel in the image in the first place. I'm not an artist, I'm a programmer and sometimes I may not have the luxury of an artist to make it a certain way. Knowing how to do it is what I need.
I'd recommend writing a small tool to convert the graphics for your game, then. Easy peazy.
Cheers,
-Jon
Cheers,
-Jon
Yeah, I just put a for loop in the texture loading that could optionally alpha out the passed in color. Lemon squeezy.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| ? Find color value of 'pixel' in color buffer? | Elphaba | 1 | 3,766 |
Jul 22, 2009 01:23 PM Last Post: Bachus |
|

