DNA Visualizer is a computer-graphics coursework project that renders a double-stranded DNA helix in real time. The codebase is split into small modules (core, dna, renderer, ui) and uses modern OpenGL: Phong shading, off-screen rendering via an FBO, and a post-processing stack.
Highlights
- Procedural helix — nucleotide spheres, backbone tubes, base-pair bridges
- Per-base coloring (A / T / G / C) with a Watson–Crick complementary strand
- Arcball camera and ImGui panels for scene control
MutationEngine— point substitutions with on-screen highlight and history log- Post-processing — Sobel edge detection, FXAA, vignette
Detailed guides live in docs/:
| Document | Topics |
|---|---|
| Overview | Index and quick reference |
| Architecture | Modules, main loop, data flow |
| Rendering Pipeline | FBO, Phong shaders, post-process |
| DNA Model | Sequences, helix params, mutations |
| Module Reference | Public classes and APIs |
| Build & Development | Dependencies, conventions, extending |
| Layer | Libraries |
|---|---|
| Window & input | GLFW |
| OpenGL loader | GLAD |
| Math | GLM |
| UI | Dear ImGui |
| Images | STB |
Dependencies are fetched automatically via CMake FetchContent on first configure.
- CMake 3.20+
- C++17 compiler (MSVC 2019+, GCC 9+, Clang 10+)
- GPU with OpenGL 3.3 Core support
- Internet access on first configure
Windows
cmake -S . -B build
cmake --build build --config DebugLinux / macOS
cmake -S . -B build
cmake --build buildRelease: add --config Release on Windows, or -DCMAKE_BUILD_TYPE=Release on Unix.
Start the executable from the repository root — asset paths are relative to the working directory:
# Windows
.\build\Debug\dna_visualizer.exe# Linux / macOS
./build/dna_visualizer| Input | Action |
|---|---|
| Left mouse + drag | Orbit camera around the helix |
| Mouse wheel | Zoom in / out |
| Esc | Quit |
| ImGui panels | Sequence, mutations, lighting, animation, post-processing |
| Panel | Purpose |
|---|---|
| DNA Sequence | View coding strand, regenerate helix, point mutations |
| Render Settings | Animation, Phong lighting, filters, mutation log |
| Stats | FPS and frame time |
┌─────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────┐
│ 3D scene │ ──► │ Framebuffer │ ──► │ Post-process │ ──► │ ImGui │ ──► Display
│ Phong + tex │ │ color + depth│ │ Sobel/FXAA/ │ │ overlay │
└─────────────┘ └──────────────┘ │ vignette │ └─────────┘
└──────────────┘
- Scene pass — helix meshes with Phong shading and a diffuse texture.
- Off-screen buffer — color and depth stored in an FBO.
- Post-process — fullscreen quad; Sobel or FXAA, then optional vignette.
- UI — ImGui drawn on top of the final image.
See Rendering Pipeline for shader and uniform details.
| Base | Color | Complement |
|---|---|---|
| A | Red | T |
| T | Blue | A |
| G | Green | C |
| C | Yellow | G |
Strand A shows the coding sequence; strand B is built from its Watson–Crick complement.
| Effect | Description |
|---|---|
| Sobel | Edge map from scene luminance (replaces color) |
| FXAA | Fast approximate anti-aliasing (off while Sobel is active) |
| Vignette | Darkens corners; strength adjustable in UI |
dna-visualizer/
├── assets/
│ ├── shaders/ # Phong, post-process, fullscreen quad
│ └── textures/
├── docs/ # Architecture, rendering, DNA model, API reference
├── include/
│ ├── core/ # Application, Window, InputManager, Timer
│ ├── dna/ # DNASequence, HelixGeometry, MutationEngine
│ ├── renderer/ # Shader, Mesh, Camera, Texture, Framebuffer
│ └── ui/ # UILayer, UIState
├── src/
├── CMakeLists.txt
└── README.md