# kavan010/2d_opengl_window architecture

> Architecture diagram of the GitHub repository kavan010/2d_opengl_window, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kavan010/2d_opengl_window
- Repository: https://github.com/kavan010/2d_opengl_window

## Overview

This is a minimal GLFW/GLEW OpenGL application that opens a window and repeatedly clears it to a dark color. `main` owns the event loop and buffer presentation; `Engine` initializes the window and graphics context and performs each frame’s OpenGL setup. The source does not show additional rendering, input handling, or product features.

Main entry points: [`main.cpp`](https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp) (Event loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Window user"))
node_main["Event loop<br/>[main.cpp]"]
node_engine["Engine setup<br/>[main.cpp]"]
node_frame["Frame drawing<br/>[main.cpp]"]
node_glfw["GLFW"]
node_glew["GLEW"]
node_opengl["OpenGL"]

node_main -->|"constructs"| node_engine
node_main -->|"checks close"| node_glfw
node_main -->|"calls per frame"| node_frame
node_main -->|"swaps buffers"| node_glfw
node_main -->|"polls events"| node_glfw
node_main -->|"terminates"| node_glfw
node_user -->|"closes window"| node_glfw
node_engine -->|"initializes window"| node_glfw
node_engine -->|"initializes loader"| node_glew
node_engine -->|"sets viewport"| node_opengl
node_frame -->|"clears and sets matrices"| node_opengl

click node_main "https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp"
click node_engine "https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp"
click node_frame "https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_main,node_engine,node_frame toneTeal
class node_glfw,node_glew,node_opengl toneIndigo
```

## Components

### Other components

- **Window user**
- [Event loop](https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp): `main.cpp`
- [Engine setup](https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp): `main.cpp`
- [Frame drawing](https://github.com/kavan010/2d_opengl_window/blob/main/main.cpp): `main.cpp`
- **GLFW**
- **GLEW**
- **OpenGL**

## Connections

- Event loop → Engine setup: constructs
- Event loop → GLFW: checks close
- Event loop → Frame drawing: calls per frame
- Event loop → GLFW: swaps buffers
- Event loop → GLFW: polls events
- Event loop → GLFW: terminates
- Window user → GLFW: closes window
- Engine setup → GLFW: initializes window
- Engine setup → GLEW: initializes loader
- Engine setup → OpenGL: sets viewport
- Frame drawing → OpenGL: clears and sets matrices
