# wanghaoyang-wilson/cpprenderengine_opengl architecture

> Architecture diagram of the GitHub repository wanghaoyang-wilson/cpprenderengine_opengl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wanghaoyang-wilson/cpprenderengine_opengl
- Repository: https://github.com/wanghaoyang-wilson/cpprenderengine_opengl

## Overview

PyRecT3D is a cross-platform C++ 2D/3D rendering engine with a Python extension. Its documented workflows start through either the explicit multi-window API or the implicit single-window API, then use shared engine, scene, rendering, and optional GUI, collision, and media capabilities. The README documents the API distinctions and major features; source excerpts expose selected engine, queue, and platform behavior. Some subsystem links are therefore omitted where sampled source does not establish the call.

Main entry points: [`cpp/src/core/engine.cpp`](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/engine.cpp) (Engine and scene), [`cpp/src/core/explicit_app.cpp`](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/explicit_app.cpp) (Explicit API), [`cpp/src/core/message_queue.cpp`](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/message_queue.cpp) (Message queues), [`cpp/src/graphics/renderer.cpp`](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/renderer.cpp) (Renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application APIs"]
  node_explicit["Explicit API<br/>[explicit_app.cpp]"]
  node_implicit["Implicit API<br/>[implicit_api.cpp]"]
end

subgraph group_runtime["Engine Runtime"]
  node_engine["Engine and scene<br/>[engine.cpp]"]
  node_queues["Message queues<br/>[message_queue.cpp]"]
  node_events["Event loop<br/>[event_loop.cpp]"]
  node_math["Math primitives<br/>[math.cpp]"]
end

subgraph group_visual["Rendering and UI"]
  node_renderer["Renderer<br/>[renderer.cpp]"]
  node_gl["GL backend<br/>[gl_backend.cpp]"]
  node_compositor["Compositor<br/>[compositor.cpp]"]
  node_gui["GUI components<br/>[gui.cpp]"]
end

subgraph group_domain["Interaction and Media"]
  node_collision["Collision world"]
  node_video["Video manager<br/>[video.cpp]"]
  node_audio["Audio<br/>[audio.cpp]"]
  node_obj["OBJ loader<br/>[obj_loader.cpp]"]
end

subgraph group_interop["Platform and Python"]
  node_platform["Platform adapters<br/>[platform_private.h]"]
  node_python["Python bindings<br/>[binding.cpp]"]
  node_web["Web bridge<br/>[pyrect3d_web.js]"]
  node_android["Android bridge<br/>[native_bridge.cpp]"]
end

node_developer(("Application developer"))
node_app_user(("Engine user"))

node_developer -->|"configures and starts"| node_explicit
node_developer -->|"starts quick app"| node_implicit
node_explicit -->|"creates windows"| node_engine
node_implicit -->|"starts shared core"| node_engine
node_explicit -->|"mounts window queues"| node_queues
node_engine -->|"creates platform"| node_platform
node_engine -.->|"uses scene geometry"| node_math
node_engine -.->|"dispatches events"| node_queues
node_explicit -->|"creates and binds UI"| node_gui
node_explicit -->|"creates players"| node_video
node_engine -.->|"renders scene"| node_renderer
node_renderer -.->|"uses graphics backend"| node_gl
node_renderer -->|"submits for composition"| node_compositor
node_gui -->|"contributes UI drawing"| node_compositor
node_engine -.->|"supports collision queries"| node_collision
node_video -->|"publishes media events"| node_queues
node_collision -->|"publishes collision events"| node_queues
node_app_user -->|"uses Python extension"| node_python
node_web -->|"bridges Web runtime"| node_platform
node_android -->|"bridges Android runtime"| node_platform

click node_explicit "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/explicit_app.cpp"
click node_implicit "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/implicit_api.cpp"
click node_engine "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/engine.cpp"
click node_queues "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/message_queue.cpp"
click node_events "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/event_loop.cpp"
click node_math "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/foundation/math/math.cpp"
click node_renderer "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/renderer.cpp"
click node_gl "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/gl_backend.cpp"
click node_compositor "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/compositor.cpp"
click node_gui "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/ui/gui.cpp"
click node_collision "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/physics/collision_world.cpp"
click node_video "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/media/video.cpp"
click node_audio "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/audio/audio.cpp"
click node_obj "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/foundation/io/obj_loader.cpp"
click node_platform "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/platform/platform_private.h"
click node_python "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/bindings/python/binding.cpp"
click node_web "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/WEB/bridge/pyrect3d_web.js"
click node_android "https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/Android/apk/jni/native_bridge.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_explicit,node_implicit,node_app_user toneBlue
class node_engine,node_queues,node_events,node_math toneAmber
class node_renderer,node_gl,node_compositor,node_gui toneMint
class node_collision,node_video,node_audio,node_obj toneRose
class node_platform,node_python,node_web,node_android,node_developer toneIndigo
```

## Components

### Application APIs

- [Explicit API](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/explicit_app.cpp): `cpp/src/core/explicit_app.cpp`
- [Implicit API](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/implicit_api.cpp): `cpp/src/core/implicit_api.cpp`

### Engine Runtime

- [Engine and scene](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/engine.cpp): `cpp/src/core/engine.cpp`
- [Message queues](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/message_queue.cpp): `cpp/src/core/message_queue.cpp`
- [Event loop](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/event_loop.cpp): `cpp/src/core/event_loop.cpp`
- [Math primitives](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/foundation/math/math.cpp): `cpp/src/foundation/math/math.cpp`

### Rendering and UI

- [Renderer](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/renderer.cpp): `cpp/src/graphics/renderer.cpp`
- [GL backend](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/gl_backend.cpp): `cpp/src/graphics/gl_backend.cpp`
- [Compositor](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/graphics/compositor.cpp): `cpp/src/graphics/compositor.cpp`
- [GUI components](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/ui/gui.cpp): `cpp/src/ui/gui.cpp`

### Interaction and Media

- [Collision world](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/physics/collision_world.cpp): `cpp/src/physics/collision_world.cpp`
- [Video manager](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/media/video.cpp): `cpp/src/media/video.cpp`
- [Audio](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/audio/audio.cpp): `cpp/src/audio/audio.cpp`
- [OBJ loader](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/foundation/io/obj_loader.cpp): `cpp/src/foundation/io/obj_loader.cpp`

### Platform and Python

- [Platform adapters](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/core/platform/platform_private.h): `cpp/src/core/platform/platform_private.h`
- [Python bindings](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/cpp/src/bindings/python/binding.cpp): `cpp/src/bindings/python/binding.cpp`
- [Web bridge](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/WEB/bridge/pyrect3d_web.js): `WEB/bridge/pyrect3d_web.js`
- [Android bridge](https://github.com/wanghaoyang-wilson/cpprenderengine_opengl/blob/main/Android/apk/jni/native_bridge.cpp): `Android/apk/jni/native_bridge.cpp`

### Other components

- **Application developer**
- **Engine user**

## Connections

- Application developer → Explicit API: configures and starts
- Application developer → Implicit API: starts quick app
- Explicit API → Engine and scene: creates windows
- Implicit API → Engine and scene: starts shared core
- Explicit API → Message queues: mounts window queues
- Engine and scene → Platform adapters: creates platform (evidence: `cpp/src/core/engine.cpp`)
- Engine and scene → Math primitives: uses scene geometry
- Engine and scene → Message queues: dispatches events
- Explicit API → GUI components: creates and binds UI
- Explicit API → Video manager: creates players
- Engine and scene → Renderer: renders scene
- Renderer → GL backend: uses graphics backend
- Renderer → Compositor: submits for composition
- GUI components → Compositor: contributes UI drawing
- Engine and scene → Collision world: supports collision queries
- Video manager → Message queues: publishes media events
- Collision world → Message queues: publishes collision events
- Engine user → Python bindings: uses Python extension
- Web bridge → Platform adapters: bridges Web runtime
- Android bridge → Platform adapters: bridges Android runtime
