   Multipass Rendering  (basic)
  I made a post about 3 weeks ago and I didn't get the information I needed so I'll just try again...I'm trying to make an object with 2 different shaders applied to it. I'm starting out really basic. I made 2 different color shaders. one makes the color red and the other blue. I enable blending and use the values GL_ONE, GL_ONE. I then draw a triangle onto the screen using my mesh class. I then apply the red material. (red shader) I repeat this process only I use gl_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA as my blending mode and I apply the blue material. I also set the glColor to glColor4f(1.0f,1.0f,1.0f,0.5f) so I draw the blue triangle with a 50 percent alpha. When I compile and run this program however, I only see the blue triangle. I think this is because in the blue shader is use gl_FragColor(0.0f, 0.0f, 1.0f, 1.0f) Notice that I pass 1 as alpha. How should I blend the red triangle and the blue triangle to get some sort of purple triangle? Thanks!   
  To blend red+blue=purple, you want additive blending.  Pseudo:GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHAred triGL_ONE, GL_ONEblue tri   ;  AFAIK, setting glColor4f(1.0f,1.0f,1.0f,0.5f) will only work for FFP, and has no effect when shaders are used. Alpha used for blending will be the alpha value set by your shader.[Edited by - stalef on February 12, 2010 7:41:54 PM]