title: Coloring grayscale image in OpenGL
body: <p>I'm trying to draw grayscale image in color as texture in OpenGL using two colors. Black goes to color1 and white goes to color2. Texture is loaded using <code>GL_RGBA</code>.</p>
  
  <p>I have tried two solutions:</p>
  
  <p>1)</p>
  
  <ul>
  <li>Load image as texture</li>
  <li>Draw image on screen</li>
  <li>Enable blending</li>
  <li><code>glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);</code> and draw rectangle with color1</li>
  <li><code>glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE);</code> and draw rectangle with color2</li>
  </ul>
  
  <p>But... When I apply first color, there is no black color on screen and when second color is applied it is combined with first color too.</p>
  
  <p>2)</p>
  
  <ul>
  <li>Save image as texture but don't use grayscale image, use white image with alpha channel that is same as grayscale</li>
  <li>Draw rectangle with color1</li>
  <li>Draw image</li>
  </ul>
  
  <p>But... When image is drawn it doesn't use color1 where image is transparent, instead it uses current color set with glColor.</p>
  
  <p>Any help will come in handy :)</p>