
varying vec4 diffuse, ambient;
varying vec3 normal, lightDir, halfVector;

void main()
{
    // normalize light direction
	lightDir = normalize(vec3(gl_LightSource[0].position));
	
    vec4 v = vec4(gl_Vertex);       
    v.y = sin(v.x);

    vec3 n = normalize(vec3(1/cos(v.x), 1.0f, 0.0f));
    normal = normalize(gl_NormalMatrix * n);

    // normalize the halfVector to pass it to the fragment shader
    halfVector = normalize(gl_LightSource[0].halfVector.xyz);

    // compute diffuse and ambient colors
    diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
    ambient = gl_FrontMaterial.ambient * (gl_LightSource[0].ambient + gl_LightModel.ambient);
    
    gl_Position = gl_ModelViewProjectionMatrix * v;
} 


