How thecherno/opengl works
Main Components
• OpenGL-Core Library: This is the heart of the project. It contains several submodules:
• Core Functionality (application management, layer system, logging, input management, event system, and window handling)
• Utility Components (shader management, camera, orthographic controllers, and debugging utilities)
• ImGui Integration (for GUI layer functionalities)
• Platform Specific Implementations (Windows-specific implementations for input and window operations)
• OpenGL-Examples: Contains sample applications which demonstrate how to use the core OpenGL functionality.
• OpenGL-Sandbox: Provides a playground or experimental area (SandboxApp and SandboxLayer) where users can write and test custom OpenGL code.
• Build/Configuration Tools: The premake5 scripts and the batch script (scripts/Win-Premake.bat) to generate Visual Studio solutions/projects.
• Vendor: Third-party libraries used by the project (could include dependencies for OpenGL or ImGui).
Relationships and Interactions
• The example and sandbox applications act as consumers or clients of the OpenGL-Core library.
• The core library is built in a modular fashion. For instance, the “Core” folder contains application initialization, event handling, and logging, while the “Platform” folder abstracts platform-specific operations (currently only Windows is “officially” supported).
• Components inside OpenGL-Core interact internally: the Application class drives the main loop, LayerStack manages different layers (including ImGui integration), and the Utility modules support common features like shader compilation or camera management.
• The platform-specific modules (under “Platform/Windows”) are accessed from the Core modules to provide correct input and window management on Windows.
• Build scripts (premake5.lua at various levels) coordinate building all these modules and their interdependencies.
Architectural Patterns and Design Principles
• Modular design: Components (Core, Events, Util, ImGui, Platform) are clearly separated for ease of maintenance and clarity.
• Abstraction layers: Abstractions for platform details (Windows-specific implementations) hide hardware-specific details from the main application logic.
• Layered architecture: Incorporates a layer system (Layer and LayerStack) that can easily add or remove functionality in the rendering and event pipeline.
• Extensibility: The inclusion of example and sandbox projects shows that the core library is designed for experimentation and can be extended by client code.
• Core (Application, Logging, Layer/LayerStack)
• Events (various event types)
• ImGui (ImGuiLayer and supporting code)
• Utilities (Shader management, Camera and Orthographic camera utilities, Debug tools)
• Platform (Windows implementation for input and window management)
Final Advice
• Don’t hesitate to create as many detailed components as possible. Even if some are smaller (like individual header sets or the platform abstractions), break them out if it clarifies the overall design.