ofSetColor + ofImage/ofTexture

When compositing images with shapes… i.e., in the same draw():

  • draw an ofImage or ofTexture
  • set a color
  • draw an ofRectangle

The ofSetColor ends up tinting the ofImage or ofTexture. Uhh. Is there any way to not do this or to reset the color so that the image composites as intended. Seems a bit odd…


ofSetColor(255, 255, 255);  // set color to white  
myImage.draw(...);   draw image (tinted white, i.e. untinted)  
ofSetColor(255, 0, 0); // set color to red  
ofRect(...); // draw rectangle (red)  


Of course! In my fervor to do things fast and lazy I tried filling to black and saw that it tinted black, and made the assumption that it would also tint towards white…

bit of info: the tinting works as a multiply (like the blend mode in photoshop), every component of every pixel of your texture is multiplied by the corresponding components of your tint color. It’s not an additive or mixing tint like you can do in flash. e.g. if you have a blue texture, and you try to draw it with a red tint, you will get black (1, 0, 0 x 0, 0, 1 = 0, 0, 0). Tinting with white simply means multiplying with 1, so draws unchanged.