title: Adding colors in cocos2d for iOS
body: <p>I am trying to do something like the RGB circle using cocos2d:</p>
  
  <p><img src="https://i.stack.imgur.com/tKETN.png" alt="enter image description here"></p>
  
  <p>I have movable circles (one for R, other for B and other for G) and I would like to calculate the colors of the intersected circles automatically (without creating something over a specific area with the new color - this is the solution I am using). </p>
  
  <p>Is there a way to add colors automatically?</p>
  
  <p><strong>What am I doing now?</strong></p>
  
  <p>Currently I am using a 1x1 blank png (as a texture that) in a <code>CCSprite</code> and then I change the <code>CCSprite</code>'s color (<code>sprite.color = ccc3(r, g, b)</code> for each circle).</p>
  
  <p><strong>What did I try?</strong></p>
  
  <p>I have tried to use different blend modes in my sprites using <code>mySprite.blendFunc = (ccBlendFunc) { GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA };</code>
   and even added some opacity (both directly in the sprite or in the texture using the mode    <code>[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888]</code>) but I can't get the effect I want. </p>
  
  <p>I have tried to find a combination in the <a href="http://www.andersriggelsen.dk/glblendfunc.php" rel="nofollow noreferrer">website with several blending modes</a> but I didn't find a combination that worked.</p>