PDA

View Full Version : transparent color into Bitmap



ijonesfr
05-20-2003, 05:56 AM
Hello,

I would like to draw one bitmap by using the fallowing instruction:

glDrawPixels( theH, theV, GL_RGB, GL_UNSIGNED_BYTE, thePicture);

That function well. Now, I would like to "not draw" (transparent) one color from my bitmap (Ex: I no want the draw function draw the 0xFF, 0xF0, 0XF0 color).

Please, I hope someone can help me because I'm a dummy on OGL http://192.48.159.181/discussion_boards/ubb/frown.gif

Thanks fro your reply and help.

Cheers,
Stef

nexusone
05-20-2003, 06:22 AM
Are you wanting to make a sprite type object?

If so, DrawPixels is not the best way to go about it.

But by using textured mapped quads and the alpha channel to create a transparentcy map.

Look at nehe.gamedev.net lesson number 32 or 33 is on making sprites in opengl for games.





Originally posted by ijonesfr:
Hello,

I would like to draw one bitmap by using the fallowing instruction:

glDrawPixels( theH, theV, GL_RGB, GL_UNSIGNED_BYTE, thePicture);

That function well. Now, I would like to "not draw" (transparent) one color from my bitmap (Ex: I no want the draw function draw the 0xFF, 0xF0, 0XF0 color).

Please, I hope someone can help me because I'm a dummy on OGL http://192.48.159.181/discussion_boards/ubb/frown.gif

Thanks fro your reply and help.

Cheers,
Stef

Adrian67
05-21-2003, 11:48 AM
Alternatively, make the image 32-bits deep and use the GL_RGBA format. Then you can specify the transparency in the alpha channel. Set it to 0 for transparent pixels and 255 for opaque ones.
Set glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), enable blending and draw the image.

Don't forget to disable blending afterwards or the Earth will spiral into the sun.