This one is taken from one of my favourite books (OpenGL 4.0 Shading Language Cookbook) and the relevant chapter’s title for this tutorial in the book is called “Implementing diffuse, per-vertex shading with a single point light source”. Of course it’s modified to use OpenGL ES in Qt which is more cross-platform and creates less issues with building and running on different operating systems (including Android and iOS)
The example project that I am going to share in this post is the absolute beginner guide version of using OpenGL in Qt (Specially Qt5 and latest versions of OpenGL) which to my surprise I could not find anywhere. By checking the existing OpenGL examples in Qt I noticed they all make some assumptions about what you know about OpenGL and then go ahead and describe how to use in in Qt. [I hope, I really do] that is not what you’ll find here. So without further ado here is the most simple example.