glDrawPixel + transparency

Hi everybody, I have this problem: I created a music editor in which each figure is rendered using the glDrawPixel of a bitmap representing the figure. Now the bitmap background is white and can cover other figure in the near. I would like to know if there is any way to say openGL to treat the white as a transparent color.ù
The follwing the code I use to render each music figure:

glPixelTransferi(GL_UNPACK_ALIGNMENT,4); glRasterPos2i(this->position[0]-10,this->position[1]+10);
glDrawPixels(BM.bmWidth, BM.bmHeight,GL_RGB, GL_UNSIGNED_BYTE, BM.bmBits);

Thank you so much for the help.


Why not transfering these bitmaps permanently to GPU memory as textures?
Then you only need to enable alpha test and draw a quad covered with this texture. Transparency in OpenGL is usually done using alpha channel.
It will be much better that transfering bitmap to GPU every time you need to draw it. From main OpenGL site go to: Coding resources/Sample code & tutorials.

Hi K, I am agree with you. But …how. As I understand from your answer I should threat each bitmap as a texture. So each figure should be rendered as a squared textured with my bitmap and then I can manage the alpha channel. Is that right?

Thank you.


Actually you could place all images in one, large texture and just draw rectangles covered with fragments of that texture - this way you can avoid texture switching.