Advertisement

GL_ONE_MINUS_SRC_ALPHA

Started by October 22, 2020 04:28 PM
2 comments, last by taby 4 years, 3 months ago

Hello,

There is documentation for GL_ONE_MINUS_SRC_ALPHA on https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glBlendFunc.xml

I am trying to emulate that in C++ code:

vertex_3 white(1.0f, 1.0f, 1.0f);
vertex_3 pc(player_colour[0], player_colour[1], player_colour[2]);
vertex_3 ec(enemy_colour[0], enemy_colour[1], enemy_colour[2]);

vertex_3 final_colour = lin_interp(white, pc, 1 - t_player);
final_colour = lin_interp(final_colour, ec, 1 - t_enemy);

Is this approach correct?

Here is an image. The player colour is yellow, and the enemy colour is blue:

https://www.andersriggelsen.dk/glblendfunc.php

Heres a link where you can check how blending is done. Theres also an equation displayed too

You didint provide where src alpha is situated (source/dest) and what is other parameter so.my answer is no

Advertisement

Right, I use 1-t_player and 1-t_enemy as the alpha values during the linear interpolation.

I found another page that basically goes to show that it's just a linear interpolation. Thanks for the link, which confirms it.

This topic is closed to new replies.

Advertisement