View Full Version : Image Transparency

Mr Pink
01-05-2003, 01:11 PM
I'm blitting a 24bits RGB bitmap image with glDrawPixel and I want a certain color of the image (let's say 1.0f,0.0f,1.0f) not to be displayed. Is there anyway I can achieve it???

I've tried blending but it seems to work well only for textures and primitives, not for images. Maybe I'm wrong???

Is there anyway to get transparency for a particular color when drawing pictures to the screen???

Thanks to everyone

Mr Pink http://www.opengl.org/discussion_boards/ubb/confused.gif

01-05-2003, 02:49 PM
there is a tutorial on masking on nehe's website.

01-05-2003, 06:17 PM
The best way is to create a transparentcy mask using the alpha channel.
nehe.gamedev.net has a good tutor on it, number 33.

I think you could do it with blending, but would have to have two images, one the origonal image and the other a mask of the areas to be transparent.

Mr Pink
01-06-2003, 05:19 PM
Thanks to everyone for the masking technique it is really usefull.

However I did my own function that converts my BMP from RGB to RGBA (not really hard, you add a byte after each RGB bytes while reading the file to load it and set it between 0x00 and 0xFF).

This way I now have the full control over each pixel opacity of my new RGBA bitmap and if I want transparency I easily achieve it with a simple ALPHA TEST.

Thanks a lot to everyone anyway.
I've appreciated learning about Masking I'm sure it will be usefull soon!!!

Mr Pink http://www.opengl.org/discussion_boards/ubb/smile.gif

01-07-2003, 09:41 AM
I'm interested with your technique. Can you please help me how you did it? can you give me any source code?


Mr Pink
01-10-2003, 03:59 PM
No Problem for the source,if you want it
just e-mail me @


Put OpenGL in the subject and I'll send it to you.

Please specify in the e-mail what you want exactly :

Just the function that does the conversion or a simple app that uses it (with the sources of course)?

Mr Pink http://www.opengl.org/discussion_boards/ubb/smile.gif