These 2 shaders are giving me very strange results. They are supposed to implement Phong shading. Please help (currently I am shading a sphere, so I calculate the normals in the shader).

```
#version 120
// viewing transformations
uniform mat4 mv_matrix;
uniform mat4 p_matrix;
// lights
uniform vec3 ws_light_position;
uniform vec3 light_color;
// ambient values
uniform float ambient_coefficient;
uniform vec3 ambient_color;
// diffuse values
uniform float diffuse_coefficient;
uniform vec3 diffuse_color;
// attributes
attribute vec3 ws_vertex_position;
varying vec3 diffuse_color_;
varying vec3 ws_vertex_position_;
void main()
{
gl_Position = p_matrix * mv_matrix * vec4(ws_vertex_position, 1);
vec3 ws_N = normalize(ws_vertex_position);
vec3 ws_L = normalize(ws_light_position - ws_vertex_position);
diffuse_color_ = ambient_coefficient * ambient_color +
light_color * diffuse_coefficient * diffuse_color *
max(dot(ws_L, ws_N), 0);
ws_vertex_position_ = ws_vertex_position;
}
```

```
#version 120
// viewing transformations
uniform mat4 mv_matrix;
// lights
uniform vec3 ws_light_position;
uniform vec3 light_color;
// specular values
uniform float specular_coefficient;
uniform vec3 specular_color;
uniform float specular_n;
// attributes
varying vec3 diffuse_color_;
varying vec3 ws_vertex_position_;
void main()
{
vec3 ws_viewer_position = vec3(mv_matrix[3]);
vec3 ws_N = normalize(ws_vertex_position_);
vec3 ws_L = normalize(ws_light_position - ws_vertex_position_);
vec3 ws_R = 2 * dot(ws_L, ws_N) * ws_N - ws_L;
vec3 ws_V = normalize(ws_viewer_position - ws_vertex_position_);
float RdotV = dot(ws_R, ws_V);
if (RdotV > 0)
{
gl_FragColor = vec4(diffuse_color_ +
light_color * specular_coefficient * specular_color *
pow(dot(ws_R, ws_V), specular_n), 1);
}
else
{
gl_FragColor = vec4(diffuse_color_, 1);
}
}
```