glDrawPixels() with color masking?

Started by
0 comments, last by V-man 16 years, 9 months ago
I have images with a RGB(200,248,211) background. I need this to be transparent with everything else showing in opengl. I am using glDrawPixels for a good reason which is hard to explain :). All i need to know is how can i remove that color from the picture so it will be transparent when rendered. I was always using TGA and using textures so i didn't have this problem . Thanks for any help.
Advertisement
You can do it with alpha blending

Put an alpha channel into the pixels you are sending with glDrawPixels and enable blending and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement