# mcnopper/opengl architecture

> Architecture diagram of the GitHub repository mcnopper/opengl, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mcnopper/opengl
- Repository: https://github.com/mcnopper/opengl

## Overview

##### Project Type and Purpose
This is an educational/demonstration project showcasing various OpenGL 3 and 4 features through 45 examples, ranging from basic window initialization to advanced graphics techniques.

##### Main Components

A. Core Framework Layer:
- GLUS Framework (Base Layer)
- Window Management (GLFW integration)
- File I/O Systems
- Math Utilities
- Memory Management
- Extension Management

B. Resource Management Layer:
- Asset Loading Systems
- Texture Loaders (TGA, HDR, PKM)
- Model Loaders (Wavefront OBJ)
- Shader Management

C. Rendering Pipeline:
- Graphics Pipeline Stages
- Vertex Processing
- Geometry Processing
- Fragment Processing
- Compute Pipeline (for applicable examples)

D. Example Implementation Layer:
- Categorize examples into groups:
- Basic Rendering (Examples 1-6)
- Advanced Techniques (Examples 7-15)
- Special Effects (Examples 16-26)
- Advanced Lighting (Examples 27-33)
- Modern Techniques (Examples 34-45)

**[External Dependencies Layer]**

- ▼
**[GLUS Framework Layer]**

- ▼
**[Resource Management Layer]**

- ▼
**[Rendering Pipeline Layer]**

- ▼
**[Example Implementation Layer]**

##### Specific Elements

A. External Dependencies (Top Layer):
- OpenGL 3/4
- GLFW
- GLEW

B. GLUS Framework Components:
- Window Management
- Math Libraries
- Memory Management
- File I/O
- Extension Handling

C. Resource Management:
- Texture Loading Pipeline
- Model Loading Pipeline
- Shader Management System

D. Rendering Features:
- Shader Programs
- Buffer Management
- State Management
- Pipeline Controls

##### Implementation Notes

- Use rectangles for specific implementations
- Version numbers for OpenGL requirements
- Notes for hardware-specific limitations
- Interaction between examples and framework

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef framework fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef resource fill:#90EE90,stroke:#333,stroke-width:2px
    classDef pipeline fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef examples fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% External Dependencies Layer
    subgraph External
        OpenGL["OpenGL 3/4"]
        GLFW["GLFW Library"]
        GLEW["GLEW Library"]
    end

    %% GLUS Framework Layer
    subgraph Framework
        WM["Window Management"]
        FIO["File I/O System"]
        MATH["Math Utilities"]
        MEM["Memory Management"]
        EXT["Extension Management"]
    end

    %% Resource Management Layer
    subgraph Resources
        TL["Texture Loading"]
        ML["Model Loading"]
        SM["Shader Management"]
    end

    %% Rendering Pipeline Layer
    subgraph Pipeline
        VP["Vertex Processing"]
        GP["Geometry Processing"]
        FP["Fragment Processing"]
        CP["Compute Pipeline"]
    end

    %% Example Implementation Layer
    subgraph Examples
        BR["Basic Rendering<br/>(Examples 1-6)"]
        AT["Advanced Techniques<br/>(Examples 7-15)"]
        SE["Special Effects<br/>(Examples 16-26)"]
        AL["Advanced Lighting<br/>(Examples 27-33)"]
        MT["Modern Techniques<br/>(Examples 34-45)"]
    end

    %% Connections
    OpenGL --> Framework
    GLFW --> WM
    GLEW --> EXT

    WM --> Resources
    FIO --> Resources
    MATH --> Resources
    MEM --> Resources
    EXT --> Resources

    TL --> Pipeline
    ML --> Pipeline
    SM --> Pipeline

    Pipeline --> Examples

    %% Click Events
    click WM "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_window.h"
    click FIO "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_file.h"
    click MATH "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_math.h"
    click MEM "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_memory.h"
    click EXT "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_extension.h"
    click TL "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_image.h"
    click ML "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_wavefront.h"
    click SM "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_program.h"
    click GP "https://github.com/McNopper/OpenGL/blob/master/GLUS/src/GLUS/glus_shape_adjacency.h"
    click GLEW "https://github.com/McNopper/OpenGL/tree/master/External/x86/Windows/MSVC/include/GL/"
    click GLFW "https://github.com/McNopper/OpenGL/tree/master/External/x86/Windows/MSVC/include/GLFW/"

    %% Style Applications
    class OpenGL,GLFW,GLEW external
    class WM,FIO,MATH,MEM,EXT framework
    class TL,ML,SM resource
    class VP,GP,FP,CP pipeline
    class BR,AT,SE,AL,MT examples
```
