Specular Lighting Math

s_vector = normalize( light_dir + view_dir )

specular_intensity = (s_vector dot normal)shininess


R  =  specular_intensity * light.r * material.r
G  =  specular_intensity * light.g * material.g
B  =  specular_intensity * light.b * material.b

(light.r is the red value of the GL_SPECULAR color of the light source, etc.)