Advertisement

Bitmap transparency?

Started by June 11, 2003 10:01 AM
6 comments, last by DalTXColtsFan 21 years, 8 months ago
I''m sure this is a FAQ - could someone please point me in the right direction if I want a transparent bitmap? I don''t mean blending, I know how to turn blending on, I mean like making it a circle or some other non-easily-rectanglable shape that when rendered in front of something hides part of it and doesn''t hide part of it. Any pointers will be cool! Thanks Joe Love means nothing to a tennis player

My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)

i beleve bitmaps dont contain and alpha channel. TGA''s are the closest to a bmp with a ALpha chanel
Advertisement
When u use a bitmap-File u can only reach transparency with blending. With blending u can cut off the black part of the textures. A bmp-File doesn''t support an alpha-Value, this file is only based on RGB-Values...

To use transparent Textures, perhaps to simulate a hole in a wall or an atmosphere u must use TGA-Files (RGBA), where u''re grafic-designer has set alpha-values !

Hope it helps,
Christian
Sorry, guys, but if you''d take a look at the bmp file spec you would discover that bmp files do indeed support 32 bit color depth - that is, they do support an alpha plane.

PNG, TGA, BMP (and DIB) formats all provide 32 bit modes. Others as well, no doubt, but those are three that spring to mind.

BMPs may support an alpha channel, but it is not widely used. If you want to do blending like u said with a BMP, there is a tutorial out there that may be useful. I can remember the link but it is contained in an OpenGL texture library.

When you load in your bitmap, you check each pixel to see what colour it is. If it is a specific colour, (e.g. 204, 204, 255), then assign it full alpha. if it isnt that colour, assign it no alpha. then when you render it, turn on blending. Worked for me.
:::MR:::
Another alternative, depending on your circumstance, is to pre-blend the image with what will be the background colors, and avoid 32-bit depth and alpha plane stuff within GL entirely. Obviously, this only works if the image was to be superimposed over something with fixed colors. If the underlying surface is supposed to change, and the change is to be seen through transparent areas of the texture, this won''t work.
Advertisement
Id recomend using TGA, or masking.
thanks for the tips everyone.

What exactly is masking?

Love means nothing to a tennis player

My nothing-to-write-home-about OpenGL webpage. (please pardon the popups!)

This topic is closed to new replies.

Advertisement