Making modifications void main of lighting.frag

Check out the following steps to understand the modifications:

  1. In the void main of lighting.frag, we're going to get rid of all the initially present code and add fresh code to it. We'll start by adding vec3 normal. We're just going to be normalizing using Normal.
  2. Then we're going to create a vec3 for viewDir. This is going to normalize the difference between viewPos and FragPos.
  3. Now we need to do the directional lighting calculation. With this, we're just going to be calling the CalcDirLight method. So, we're not going to be doing much code in main. Because we're adding more stuff to it, it's becoming like another C++ project because we are abstracting it out into different methods, so ...

Get Learn OpenGL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.