title: OpenGL Additive blending causes white screen
body: <p>I'm working on a deferred shading project and I've got a problem with blending all the lights into the final render. </p>
  
  <p>Basically I'm just looping over each light and then rendering the fullscreen quad with my shader that does lighting calculations but the final result is just a pure white screen. If I disable blending, I can see the scene fine but it will be lit by one light.</p>
  
  <pre><code>void Render()
  {
      FirstPass();
      SecondPass();
  }
  
  void FirstPass()
  {
      glDisable(GL_BLEND);
      glEnable(GL_DEPTH);
      glDepthMask(GL_TRUE);
  
      renderTarget-&gt;BindFrameBuffer();
      gbufferShader-&gt;Bind();
  
      glViewport(0, 0, renderTarget-&gt;Width(), renderTarget-&gt;Height());
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
      for (int i = 0; i &lt; meshes.size(); ++i)
      {
          // set uniforms and render mesh
      }
      renderTarget-&gt;UnbindFrameBuffer();
  }
  </code></pre>
  
  <p>EDIT: I'm not rendering light volumes/geometry, i'm just calculating final pixel colours based on the lights (point/spot/directional).</p>
  
  <pre><code>void SecondPass()
  {
      glDepthMask(GL_FALSE);
      glDisable(GL_DEPTH_TEST);
      glEnable(GL_BLEND);
      glBlendFunc(GL_ONE, GL_ONE);
  
      renderTarget-&gt;BindTextures();
  
      pointLightShader-&gt;Bind();
  
      glViewport(0, 0, renderTarget-&gt;Width(), renderTarget-&gt;Height());
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
      for (int i = 0; i &lt; lights.size(); ++i)
      {
          // set uniforms
          // shader does lighting calculations 
          screenQuad-&gt;Render();
      }
      renderTarget-&gt;UnbindTextures();
  }
  </code></pre>
  
  <p>I can't imagine there being anything special to do in the shader other than output a vec4 for the final frag colour each time?</p>
  
  <p>This is the main part of the pointLight fragment shader:</p>
  
  <pre><code>out vec4 FragColour;
  
  void main() 
  {
      vec4 posData = texture(positionTexture, TexCoord);
      vec4 normData = texture(normalTexture, TexCoord);
      vec4 diffData = texture(diffuseTexture, TexCoord);
  
      vec3 pos = vec3(posData);
      vec3 norm = vec3(normData);
      vec3 diff = vec3(diffData);
  
      float a = posData.w;
      float b = normData.w;
      float c = diffData.w;
  
      FragColour = vec4(shadePixel(pos, norm, diff), 1.0);
  }
  </code></pre>
  
  <p>But yeah, basically if I use this blend the whole screen is just white.</p>