Some simple OpenGL demos in C++, now compiled for the web with Emscripten.
This example draws a yellow rectangle on a blue background.
If anything goes wrong it will display a red image and print errors to the console.
Demo
Source Code
This demo shows off simple usage of the model, view, and projection matrices to display a spinning rectangle.
Demo
Source Code
This demo shows how to do basic lighting using object normals.
It uses Lambertian diffuse and Blinn-Phong specular.
A geometry shader is used to draw the normal vectors and the light vector in the desktop version.
Demo
Source Code
This demo shows how to do more realistic lighting.
It uses a simple PBR material model, with a microfacet based BRDF and hacked up diffuse.
It also performs tonemapping to correctly deal with the high dynamic range of real lighting.
Based off of this great SIGGRAPH Course.
Demo
Source Code