Jump to content
  • Advertisement
Sign in to follow this  
zaneski13

Multipass Rendering (basic)

This topic is 3047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!