PDA

View Full Version : Additive blending with GLSL



Esa
08-03-2005, 12:30 AM
I want to do additive blending using GLSL. With fixed pipeline I would use:

glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);

drawStuff()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?

Relic
08-03-2005, 12:46 AM
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.