title: Qt, particle system and additive blending
body: <p>I’m creating a particle system using Qt and c++. I want to blend colours of the particles that overlap each other – adding the RGB values on top of each other, so colours would get brighter, something like this:<br />
  <img src="https://i.stack.imgur.com/7BP2C.png" alt="Desired effect1" /></p>
  <p>My code looks like this:</p>
  <pre><code>In custom QGraphicsScene class:
      QPixmap* pixmap2 = new QPixmap(&quot;E:\\Qt_workspace\\1\\smoke5.png&quot;);
      pixmap2-&gt;setDevicePixelRatio(0.5);
      QPointF origin2 = {250, 100};
      QPainter pix2(pixmap2);
      pix2.setCompositionMode(QPainter::CompositionMode_Plus);
      pix2.drawPixmap(origin2, *pixmap2);
      pix2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, true);
      particleSystem2 = new ParticleSystem(this, pixmap2, origin2);
      v_particleSystem.push_back(particleSystem2);
  </code></pre>
  <p>And i create particles in a loop:</p>
  <pre><code>void Level1::advance()
  {
      for (int i = 0; i &lt; v_particleSystem.size(); ++i) {
          v_particleSystem\[i\]-&gt;applyForce(gravity);
          QVector2D v = { (float)player-&gt;x(), (float)player-&gt;y() };
          repeller-&gt;update(v);
          v_particleSystem[i]-&gt;applyReppeler(repeller);
   
          v_particleSystem[i]-&gt;addParticle();
          v_particleSystem[i]-&gt;run();
      }
      update(sceneRect); ///so items dont leave any artifacts though works without it when 
  using m_view-&gt;viewport()-&gt;repaint();
      m_view-&gt;viewport()-&gt;repaint();
  </code></pre>
  <p>And Particle class derives from QGraphicsPixmapItem</p>
  <p>But im getting this result:
  <a href="https://i.stack.imgur.com/rWIqo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rWIqo.png" alt="Achieved effect" /></a></p>
  <p>Any idea how to achieve additive blending?</p>