View Full Version : normalize

01-15-2005, 01:50 AM
what the build-in function normalize return when the parameter is null ?
In the specification it's note :

genType normalize (genType x) : "Returns a vector in the same direction as x but with a length of 1."

That great but to values that are null, vectors haven't direction ...

01-16-2005, 08:48 AM
I guess they return a vector with 0 length. You could try it with
gl_FragColor = vec4(normalize(vec3(0.0)), 1.0);

01-16-2005, 09:27 PM
I guess it's undefined.

01-17-2005, 06:14 AM

So the function must return a error if parameter lentgh is null ?

01-17-2005, 06:45 PM
Functions in GLSL do not return run-time errors.

Chances are, it'll return NaN. Or perhaps Inf. Or, on some hardware, 37.