Advertisement

masking w/o alpha

Started by March 10, 2003 05:52 PM
2 comments, last by Turnip Monster 21 years, 11 months ago
Is it possible to mask a texture with out using an alpha channel/image? I want to be able to make the completely black pixels of my texture invisible (transparent) whilst leaving the other pixels unchanged. I''m quite new to OpenGL and so atm would prefer to stick with bitmaps and using a seperate masking texture seems a waste if it is possible to use some kind of glBlendFunc() to mask it. Thanks.
Doesn''t this tutorial use .bmps? Not sure, been a while since I read through those.
_______________________________________Pixelante Game Studios - Fowl Language
Advertisement
If you use additive blending (eg glBlendFunc(GL_ONE, GL_ONE)) you can use the black pixels as a no-op fragment. But the case is pretty limited to lighting effects (fire, lightning, etc).

99% of the time you''ll need an alpha channel, which is not so hard to setup on a texture.

On a bitmap (if you mean glBitmap) you''re limited to 2 colors : visible and invisible. Extremely limited range of colors.

Apart from that, you could build your own shader which discards elements that are completely black, but it''s a bit compilcated to use shaders and the performance cost is huge for what it does. Use it only as a last resort.
if your loading a 24 bit image then you might want to consider applying a filter converting it to 32 bit, setting the alpha to 255 for all non-black pixels and setting to 0 for black...

| - Project-X - my mega project.. getting warmer - | - adDeath - an ad blocker I made - | - email me - |

This topic is closed to new replies.

Advertisement