Making changes to the main code

Now we just need to go to our main.cpp file and make modifications to our code. Take a look at the following steps:

  1. In there, the first thing that we need to modify is this vertices array. At the moment, we have x, y, and z values for each of the vertices, and what we also need to include is the normal. You can refer to the updated vertices in the main.cpp file present in the Basic Lighting folder. For reference, just take a look at the vertices of one side of cube:
     //Position             //Normal         -0.5f, -0.5f, -0.5f,   0.0f, 0.0f, -1.0f,      0.5f, -0.5f, -0.5f,   0.0f, 0.0f, -1.0f,      0.5f, 0.5f, -0.5f,    0.0f, 0.0f, -1.0f,      0.5f, 0.5f, -0.5f,    0.0f, 0.0f, -1.0f,     -0.5f, 0.5f, -0.5f,    0.0f, 0.0f, -1.0f, -0.5f, -0.5f, -0.5f, 0.0f, ...

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.