Results 1 to 2 of 2

Thread: Additive blending with GLSL

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2005
    Posts
    4

    Additive blending with GLSL

    I want to do additive blending using GLSL. With fixed pipeline I would use:
    Code :
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE);
     
    drawStuff()
    Is there any way to do this with GLSL? I tried using:
    Code :
    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?

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: Additive blending with GLSL

    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.

Similar Threads

  1. Replies: 4
    Last Post: 11-04-2013, 08:12 AM
  2. Selective additive blending?
    By GetLastError in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-10-2012, 02:13 PM
  3. Additive Blending in particles
    By mouser58907 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-26-2010, 07:46 AM
  4. Additive blending problem with ppl
    By Gorg in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-05-2003, 10:30 AM
  5. Additive Blending
    By phlake in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 10-04-2000, 10:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean