Making changes to the main code to add materials to our object

Follow the below mentioned steps to add materials to our object and observe the effects of light on it:

  1. If you go to main.cpp, what you want to do is actually go straight to the while loop, because everything outside of that should is fine and doesn't need any modification.
  2. So, in lines of code below lightingShader.Use();, we'll get rid of objectColorLoc and lightColorLoc. We want lightPosLoc, but a parameter in it needs to be changed to light.position because we've updated that in our fragment shader.
  3. In gluniform3f you can get rid of objectColorLoc and lightColorLoc.
  1. Now we need to also set the light's properties. For that, we'll add glm::vec3 lightColor; and we'll add ...

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.