OpenGL ES shader normalized dot product greater than 1.0

568 views Asked by At

It's impossible for the dot product of two normalized vectors to be greater than 1.0, right? How can GLSL is saying it is greater than 5.0?

Here is the code I am using to debug, and the white pixels are appearing.

if(dot(normalize(n), normalize(h)) > 5.0)
    gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); // Why does this execute!?
else
    gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);

Does anybody see any stupid obvious mistake, or if something else could be going on? It shouldn't matter if n and h are even correct, right? It's been days...

This is OpenGL ES 2.0 if that matters.

0

There are 0 answers