standard graphics lerp

whats the standard graphics way of describing a lerp?
texenvcombine uses aX + b(1-X) but both glsl and cg use a*(1-X) + b*X

ARB_texture_env_combine INTERPOLATE_ARB
Arg0 * (Arg2) + Arg1 * (1-Arg2)

glsl genType mix (genType x,genType y,genType a)
Returns x * (1 – a) + y * a

cg lerp(a,b,f)
(1-f)a + bf

ps/ why has the glsl spec got 1 – a there that should be 1.0 - a, tsk tsk, naughty boys :slight_smile:

between = from + (to - from) * factor; // with one '*' less ;)

I think the CG/GLSL formulas are the reference because they yield β€˜from’ when the factor is 0.0f and β€˜to’ when the factor is 1.0f;

As the hw for ARB_texture_env_combine is quite restricted, the used formula could be a consequence of the hw design?

Just my 0.02€

And ARB_fp defines it as

LRP dst, src0, src1, src2;

and src0 is the weight
src0 * src1 + (1-src0) * src2

so it’s really a matter of operand order. There is no standard.

There is also the 3 operation version
src2 + src0 * (src1 - src2)