normalize

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 …

I guess they return a vector with 0 length. You could try it with
gl_FragColor = vec4(normalize(vec3(0.0)), 1.0);

I guess it’s undefined.

:stuck_out_tongue:

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

Functions in GLSL do not return run-time errors.

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

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.