desaturate an OpenGL texture
===

I have a .png with **transparency** that I need to desaturate. I read I need to take the average R,G and B value of the bitmap then use:

    G*.59
    R*.3
    B*.11

I calculate the average color in this way:

    private Color Average_Color(Bitmap bitmap) {
      Color c = new Color();
      int pixel_number = 0;
      int r = 0;
      int g = 0;
      int b = 0;

      for (int i = 0; i < bitmap.Width; i++) {
        for (int j = 0; j < bitmap.Height; j++) {
          c = bitmap.GetPixel(i, j);
            r += c.R;
            g += c.G;
            b += c.B;
            pixel_number++;
        }
      }
      c = Color.FromArgb(1, r / pixel_number, g / pixel_number, b / pixel_number);
      return c;
    }

Then, first to paint my texture, I set the Color in this way:

    rgb = Average(bitmap);
    GL.Color3(rgb.R * 0.59, rgb.G * 0.3, rgb.B * 0.11);
    //here I draw my texture

I don't know why but it doesn't work (I get the texture with his original colors). I guess it's something wrong in `Average_Color`. Maybe because it's not a total opaque bitmap?