A custom 3D rendering engine written in C++ with OpenGL 3.3, built from scratch on top of GLFW, GLEW and GLM.
The engine wraps raw OpenGL in a small set of abstractions (vertex arrays, vertex/index buffers, buffer layouts, shaders, textures, cubemap skyboxes and a free-look camera) and drives them from an ImGui test menu. Each scene is a self-contained test you pick at runtime.
Scenes:
- Clear Color - color picker bound to the clear color.
- 2D Texture - textured quad with blending.
- 3D Texture - projection and view matrices applied to a textured cube.
- Cube World - many cubes placed in 3D space.
- Solar System - the main scene. Procedurally generated UV spheres lit by Phong shading (ambient, diffuse and specular) from a light at the origin, rendered inside a cubemap skybox.
- Procedural sphere generation with positions, normals and UVs, degenerate triangles skipped at the poles.
- Phong lighting in GLSL with per-fragment normals and a view-dependent specular term.
- Cubemap skybox rendered with the translation stripped from the view matrix.
- FPS-style camera: WASD movement, mouse look, scroll to zoom.
- Custom shader parser that reads vertex and fragment stages from one
.shaderfile, with uniform location caching. - Every GL call wrapped in an error-checking macro that asserts on failure.
The Solar System scene includes a live performance monitor. It measures CPU time (matrix math and draw call submission) with std::chrono and GPU time with double-buffered GL_TIME_ELAPSED queries, so reading the result never stalls the pipeline.
A slider scales the scene from 1 to 1000 spheres. The panel shows both timings side by side and reports which side is the bottleneck. At low sphere counts the frame is GPU-bound on fragment shading. As the count rises, per-sphere uniform uploads and matrix math dominate and the frame flips to CPU-bound, which is the point the scene is built to demonstrate.
| Input | Action |
|---|---|
| W / A / S / D | Move camera |
| Mouse | Look around |
| Scroll | Zoom |
| Esc | Quit |
<- button |
Return to the test menu |
Windows only. GLEW and GLFW binaries are included under Dependencies/.
Visual Studio: open 3D-Renderer.sln and build the x64 configuration.
CMake:
cd 3D-Renderer
cmake -B out/build -A x64
cmake --build out/build --config Release
Resources under res/ are copied next to the executable after each build, so run the binary from its own build directory.
GLFW, GLEW, GLM, Dear ImGui and stb_image. GLM, ImGui and stb_image are vendored in the source tree.
