I'm using SDL 2.0 with OpenGL 2.1 on android (5.1 lollipop on a Moto G).
I have essentially this code:
vec3 norm = normalize(var_normal);
vec3 sun = normalize(sun_position-var_position);
float diff = max(dot(norm,sun),0.);
in my fragment shader.
diff
should always be a value between 0. and 1., right?
unfortunately, due to the difficulties of debugging specifics of glsl I'm not sure exactly the value that diff gets, but it seems to be vastly blown out. if I set gl_FragColor = vec4(diff,diff,diff,1.);
for debugging, I get straight white for 90% of pixels- the only ones that aren't white are those with normals just shy of orthogonal to the camera.
Here's the interesting bit- when I run it on my computer (OSX El Capitan), it works as expected.
So, instead of maxing the dot with 0., I clamp it to 0. and 1.. Then everything starts to look more reasonable, but with a visibly small diffuse range.
Any ideas moving forward regarding the differences?