How to do it...

To create a shader program that implements the Phong reflection model using a directional light source, we'll use the same vertex shader as in the previous recipe, except with a single light source.  Within the phongModel function, replace the calculation of the s vector with the following: 

vec3 s;
if( Light.Position.w == 0.0 )
s = normalize( Light.Position.xyz );
else
s = normalize( Light.Position.xyz - position );
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.90.141