Hi,
i have to render a quad with a linear gradient but i have colors for only 2 vertices like this scheme:
Ideally, i would let OpenGL to find which colors to interpolate for 2 others vertices but i’m suspect it is impossible. it’s right ?
So, how do interpolate theses yourself ?
My intuition say me that it’s corresponds to translate the diagonal (respecting //) until they reach another vertex.
In theses cases both other vertices would touch the diagonal at it’s center ! (it’s right ?) (it’s right only if the gradient line fit a square)
If it’s the case, i’m would compute the color at 50% of the gradient so that would being :
red = ( ( redB - redA ) / 2 ) + redA
green = ( ( greenB - greenA ) / 2 ) + greenA
blue = ( ( blueB - bleuA ) / 2 ) + blueA
Best regards,
Sébastien.