PDA

View Full Version : Is it possible load a bmp and make it transparent?



John Jenkins
11-06-2002, 06:39 AM
I may need to load a bmp or maybe another type of image file. I have studied blending and am wondering if it can be done to bitmaps. I have never loaded one so I don't even know if they have alpha values.

SirKnight
11-06-2002, 06:53 AM
Well it's been quite a while since I have last used a bmp in a program of mine, I generally use tga or jpg, but you can request a bmp with an alpha component. Of course this doesn't mean that the alpha is being used in some particular bmp as a transparency though. It can be used as a transparency but don't allways assume that alpha means transparency. But yes you can do what you are asking, just as long as your bmp is 32 bit obviously. http://www.opengl.org/discussion_boards/ubb/biggrin.gif If you have the red book, or even if not an older verison is on the web, there is a page or two that has the blending equation and the different tokens that can be used. Actually there are more than what will be listed there but in order to use those you need to use extensions. But for what you seem to want to do you don't have to worry about that just yet. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

-SirKnight

Dakeyras
11-06-2002, 04:05 PM
Even if your bmp does not have an alpha channel, you can programmatically add it.

Assuming your bmp is in RGB format and you want it in RGBA format, you can pad on one byte after every RGB triplet before calling glTexImage2D or gluBuild2DMipmaps.

zed
11-06-2002, 07:05 PM
check the usenet group c.g.api.opengl ive just added a suggestion that perhaps will get added to the faq