Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Additive" glBlendFunc

Tags:

opengl

If i have two overlapping triangles, each with gray color (0.1, 0.1, 0.1, 0.1), how would I set up glBlendFunc, such that the overlapping section renders brighter (closer to white) than the non-overlapping sections?

like image 208
laslowh Avatar asked Jul 09 '26 02:07

laslowh


1 Answers

You could set up your glBlendFunc like this:

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

This will give you a blend equation where output_color = 1 * source_color + 1 * destination_color.

See also this documentation.

like image 193
Bart Avatar answered Jul 11 '26 20:07

Bart