Substracting colors

I have a
gluSphere(…);
with a texture.
How do i extract a specific color
from the texture makingb this region
transparent.

-Starnut

Instead of uploading an RGB-texture, you allocate memory for a new texture of RGBA type, with the same dimensions. Loop through each pixel in the original texture and copy it to the new texture. After copying the pixel, you set the alpha component to either 1.0f (or 255) if the pixel’s color does not match the transparent color, or to 0.0f (or 0) if it does match.

Then you upload the new RGBA texture instead.

When drawing, you enable alpha test to reject pixels with an alpha of zero.

glAlpfaFunc(GL_GREATER, 0.5f); // process only pixels with alpha greater than 0.5f, reject everything else
glEnable(GL_ALPHA_TEST);
DrawTexturedObject();