# gl_example **Repository Path**: gitee00000/gl_example ## Basic Information - **Project Name**: gl_example - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-29 - **Last Updated**: 2026-07-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenGL 多角度学习项目 C++17 + CMake + OpenGL 3.3 Core,在 Windows(VS 2026)上组织的渐进式示例集。 以 **GLFW** 为主线,辅以 **SDL2** 对照,展示「窗口库只负责上下文与输入,绘制全是 OpenGL」。 ## 环境 - Visual Studio 2026(已验证生成器:`Visual Studio 18 2026`) - CMake >= 3.20 - 依赖已放在 `third_party/`(GLFW / SDL2 / GLAD / GLM / stb) ## 构建 ```powershell cd D:\project\test cmake -B build -G "Visual Studio 18 2026" -A x64 cmake --build build --config Release ``` 可执行文件输出到 `build/bin/`。 ## 示例一览 | 目标 | 内容 | |------|------| | `01_hello_window_glfw` | GLFW 创建 GL 3.3 窗口并清屏 | | `02_hello_window_sdl` | 同上,SDL2 对照 | | `03_hello_triangle` | VAO/VBO + 最简着色器 | | `04_shaders_uniforms` | uniform 动画变色 | | `05_textures` | stb_image 纹理 | | `06_transformations_camera` | MVP + 飞行摄像机 | | `07_lighting_phong` | Phong 光照 | | `08_multiple_lights` | 方向光 + 点光 + 聚光 | | `09_model_loading` | 极简 OBJ 加载器(无 Assimp) | | `10_framebuffers_postfx` | FBO 后处理(灰/反色/边缘) | | `11_shadow_mapping` | 阴影贴图 + PCF | | `12_instancing` | 1000 实例化立方体 | | `13_input_glfw` / `13_input_sdl` | 同一 `IWindow` 接口,两套输入后端 | ## 设计要点(适度) - **策略模式**:`IWindow` + `WindowGLFW` / `WindowSDL` - **RAII**:`Shader` / `Mesh` / `Texture` 管理 GL 对象生命周期 - **SRP**:公共能力集中在 `common/`,每个示例只演示一个知识点 - **不过度设计**:无 ECS、无大型引擎抽象;模型加载用手写 OBJ 解析代替 Assimp ## 学习笔记 见 [docs/notes.md](docs/notes.md)。