Basic lighting in OpenGL
In this example, we will learn how to add a simple point light to our 3D scene by using OpenGL and Qt 6.
How to do it…
Let’s get started by following these steps:
- Again, we will use the previous example and add a point light near the spinning cube. Open up 
renderwindow.hand add another variable calledvbo_normalsto the file:Â Â Â Â QOpenGLBuffer* vbo_uvs; Â Â Â Â QOpenGLBuffer* vbo_normals; Â Â Â Â QOpenGLTexture* texture;
 - Open 
renderwindow.cppand add another array callednormalsto theinitializeGL()function:Â Â Â Â GLfloat normals[] = { Â Â Â Â Â 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, Â Â Â Â Â 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, Â Â Â Â Â 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, Â Â Â Â Â 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f...