A lightweight OpenGL model viewer written in C++ with SDL2 and GLAD.
- Real-time 3D rendering with OpenGL 3.2 core profile.
- OBJ mesh loading pipeline and material-based shading.
- Camera controls, debug visualization toggles, and dynamic lighting.
- Cross-platform CMake build (macOS, Linux, Windows).
-
Windows render sample (
assets/winlambo.png): -
Additional screenshots for macOS/Linux and glTF scenes can be added under
assets/.
-
Clone and initialize submodules:
git clone <your-fork-or-repo-url> cd modelview git submodule update --init --recursive
-
Run one command setup:
./setup.sh
This installs dependencies (where supported), configures CMake, and builds into build/.
Prerequisites:
- Xcode Command Line Tools
- Homebrew
Install manually (optional if using ./setup.sh):
xcode-select --install
brew install cmake ninja pkg-configBuild:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -jNotes:
-
OpenGL is linked via system framework through CMake
find_package(OpenGL). -
macOS deprecation warnings are silenced with
GL_SILENCE_DEPRECATIONin the build. -
For universal binaries, configure with:
cmake -S . -B build -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
Install dependencies:
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config \
libx11-dev libxext-dev libxrandr-dev libxinerama-dev \
libxcursor-dev libxi-dev libxfixes-dev \
libwayland-dev libxkbcommon-dev wayland-protocolsBuild:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -jRecommended:
- Visual Studio 2022 with C++ workload
- CMake
Build options:
-
Use the included batch build:
.\compile.bat
-
Or use CMake directly from Developer Command Prompt:
cmake -S . -B build -G "Visual Studio 17 2022" cmake --build build --config Release
If you run from MSYS2/Git Bash, setup.sh will print Windows-specific guidance.
After building, run the generated executable from build/ (or the output folder for your generator/config).
src/- application and rendering codeexternal/- vendored dependencies (SDL2, GLAD, cglm, glm, stb)shaders/- GLSL shadersres/- model and texture assetsassets/- README screenshots
-
If submodules are missing, rerun:
git submodule update --init --recursive
-
If
cmakeis not found on macOS/Linux, install it with your package manager and re-run./setup.sh. -
If OpenGL context creation fails on macOS, ensure you are using the OpenGL core profile (already set in
src/main.cpp).
