Blend Out Color - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Blend Out Color (/thread-2237.html)
Blend Out Color - bmantzey - Oct 24, 2008 01:45 PM
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?
Blend Out Color - Skorche - Oct 24, 2008 02:17 PM
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.
Blend Out Color - bmantzey - Oct 24, 2008 03:08 PM
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?
Blend Out Color - ThemsAllTook - Oct 24, 2008 04:22 PM
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?
Blend Out Color - bmantzey - Oct 24, 2008 05:40 PM
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.
Blend Out Color - aarku - Oct 24, 2008 06:14 PM
I'd recommend writing a small tool to convert the graphics for your game, then. Easy peazy.
Blend Out Color - bmantzey - Nov 19, 2008 11:26 AM
Yeah, I just put a for loop in the texture loading that could optionally alpha out the passed in color. Lemon squeezy.