tags:

views:

1205

answers:

2

Is it possible in opengl to setup blending to achieve additive color overlays?

Red + green = yellow, cyan + magenta = white, etc.. (see diagram)

+5  A: 
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);

should do it.

For a tutorial, look here - also have a look at the full description of glBlendFunc.

schnaader
A: 

Simple additive blending is achieved with glBlendFunc (GL_ONE, GL_ONE). You need to be aware of the fact that OpenGL's color value range is limited to [0,1], and values greater than 1 will be clamped to 1, so adding bright colors may not produce physically correctly blended colors. If you want to achieve that, you will have to add and scale the colors in your own software rather than having OpenGL handle it, or write a shader program that does that while rendering.

karx11erx