PDA

View Full Version : a code snippet from arbvp1 to glsl,need help



Heron
03-21-2011, 08:01 PM
The code snippet ARBVP1 is
MAD result.zw, temp.x, {0.125, 0.125, 0.125, 0.125}, {0.0, 0.0, 0.0, 0.125};
I wann tranlate it to GLSL
result.zw = (temp.x * vec4(0.125, 0.125, 0.125, 0.125)+ vec4(0.0, 0.0, 0.0, 0.125)).xy
or
result.zw = (temp.x * vec4(0.125, 0.125, 0.125, 0.125)+ vec4(0.0, 0.0, 0.0, 0.125)).zw?
Which one above is correct? Thanks in advanced
Heron

Ilian Dinev
03-21-2011, 11:25 PM
result.zw = temp.xx * vec2(0.125,0.125) + vec2(0, 0.125);

or in slightly different form, but same result/operation:

result.zw = temp.x * 0.125 + vec2(0, 0.125);

Heron
03-22-2011, 09:48 PM
Thanks :D
Does that mean for arbvp1 MOV r0.zw ,r1 equal to r0.zw=r1.zw rather than r0.zw=r1.xy?