length, distance, normalize return wrong result for certain vectors. #29

Georg123 opened this Issue May 8, 2013 · 0 comments


None yet
1 participant

Georg123 commented May 8, 2013

length() method only works for vec4.

varying vec2 texcoord0;

float l = length(texcoord0);


dp4 ft1.x, v0.xyyy, v0.xyyy
sqt ft1.z, ft1.xxxx

So it calculates
sqrt(x_x + y_y + y_y + y_y)

Most likely distance() is also wrong (haven't checked).

varying vec2 texcoord0;

vec2 tc = normalize(texcoord0);


nrm ft1.xy, v0.xyyy

Error #3628: AGAL validation failed: The destination operand for the nrm instruction must mask w (use .xyz or less) at token 2 of fragment program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment