This repository contains a compact wireframe renderer with two front-ends:
render-gui— interactive OpenGL viewer (GLFW + GLAD included as vendor libraries).render-to-file— offline CPU rasterizer that writes a PNG usingstb_image_write.
All required GL-related third-party code (GLAD and GLFW) is already included in vendor/ and the project ships with a CMakeLists.txt that builds both targets.
- CMake 3.14 or newer.
- A C++17-capable compiler (g++, clang, MSVC).
- Functional OpenGL drivers on your machine.
(No external package install is required for GLAD/GLFW; those are built from vendor/.)
From the project root:
# create an out-of-source build directory
# from project root:
mkdir build
cd build
cmake ..
cmake --build .The CMakeLists.txt already:
- Builds
vendor/gladinto a staticgladlibrary. - Adds
vendor/glfwas a subdirectory. - Links targets against
glad,glfwandOpenGL::GL.
./render-gui path/to/model.obj
Controls:
- Mouse (when cursor is captured) to rotate (FPS-style yaw / pitch).
- WASD — move camera; SPACE / LCTRL — up / down.
- ESC toggles cursor capture.
- Window title displays basic status (verts/edges, camera).
./render-to-file path/to/model.obj camX camY camZ [proj] [output.png]
camX camY camZ— camera position in world space.proj(optional) —persp(default) orortho.output.png(optional) — filename. The program tries to write into../result/and will fall back to the current directory if creation fails. Example:
./render-to-file ../assets/monkey.obj -4 -3 2 ortho monkey.png
- Make sure your GPU drivers support the OpenGL version requested by GLFW on your platform.
- If CMake fails to find OpenGL, install the platform OpenGL development package (e.g.
libgl1-mesa-devon some Linux distributions). - You can find examples in
examplesfolder