Additive blending with GLSL

I want to do additive blending using GLSL. With fixed pipeline I would use:

glBlendFunc(GL_ONE, GL_ONE);


Is there any way to do this with GLSL? I tried using:

gl_FragColor += colorToAdd;

doesn’t produce correct results (I guess gl_FragColor doesn’t contain the current framebuffer color). Is it possible to do this blending in a shader?

Read the GLSL spec. GLSL does not replace the alpha blending part of the pipeline.
Your first approach should just work if the drawStuff is using GLSL or not.