OpenGL has changed a lot over the years. If you are interested in legacy OpenGL where you have access to the fixed function pipeline, you may want to look at the GLScene demos. In legacy OpenGL, the fixed function pipeline imbues materials with properties like ambient, diffuse, and specular lighting.
If you want to use modern OpenGL, there is no fixed function pipeline, and everything is done using the programmable GLSL shaders. Here is an example
https://github.com/neurolabusc/plyviewwhere the GLSL fragment shader is here:
https://github.com/neurolabusc/plyview/blob/ea98c5d9dc0eebfaef426c32e111d037c9a4ee19/unit1.pas#L138So the GLSL shader is:
```
#version 330
in vec4 vClr;
in vec3 vN, vL, vV;
out vec4 color;
uniform float Ambient = 0.4;
uniform float Diffuse = 0.7;
uniform float Specular = 0.6;
uniform float Roughness = 0.1;
void main() {
vec3 n = normalize(vN);
vec3 v = normalize(vV);
vec3 h = normalize(vL+v);
float diffuse = dot(vL,n);
vec3 AmbientColour = vClr.rgb;
vec3 DiffuseColour = vClr.rgb;
vec3 SpecularColour = vec3(1.0, 1.0, 1.0);
float specular = pow(max(0.0,dot(n,h)),1.0/(Roughness * Roughness));
color = vec4(AmbientColour*Ambient + DiffuseColour*diffuse*Diffuse +SpecularColour*specular* Specular, 1.0);
}
```
The final color ("color") is the sum of the ambient (constant lighting), the diffuse Lambertian reflection (which depends on the relation of the surface normal and light position), and the specular glint reflection (which depends on surface normal, light position and eye position).
A much more complex Lazarus project that illustrates different shaders is Surfice
https://www.nitrc.org/plugins/mwiki/index.php/surfice:MainPagehttps://github.com/neurolabusc/surf-iceYou may find this useful as it provides a lot of GLSL shaders as text files in its "Resources" folder, and the graphical interface allows you to drag sliders to change properties of the shaders. Many of these shaders illustrate more sophisticated lighting models light MatCaps, Hemispheric lighting, etc.