A great example for how I write code these days is my Game Engine’s Entity Component System. You can read the code for it here, or read a blog post explaining how it works here.
Older Samples
C++, C#, GLSL, HLSL, Unity, OpenGL
HLSL
Deferred rendering composite shader – with lighting
GLSL
Maze Generator – Complete Program
C++
C++, OpenGL
C++
C#, Unity
The next two samples are from my Pathtracer. The topics I programmed are interesting, but the code is not very clean.
I wrote it before knowing a lot about c++ coding standards or the standard library.
Diffuse BRDF – cpu pathtracing
C++
Ray Mesh intersection – with vertex interpolation
C++