[codex] Fix ImGui window framebuffer clearing#3
Merged
Conversation
Split the package into imgui.core + a generic backend abstraction layer (imgui.backend) plus reusable platform/renderer pieces composed into a single Backend type per backend. - imgui.backend: shared types (GlConfig/Error/FbSize), RecommendedGlConfig() cross-platform defaults, and a compile-time BackendApi concept. - imgui.backend.platform.glfw / imgui.backend.renderer.opengl3: reusable assembly pieces (window/events vs GL/renderer). - imgui.backend.glfw_opengl3: assembles them into ImGui::Backend::GlfwOpenGL3, static_assert(BackendApi<...>) enforced. Re-exports imgui.backend but not imgui.core; consumers import imgui.core themselves. - Uniform usage: swapping backend is a different import + one-line alias. - Cross-platform: macos/windows toolchain entries, CI matrix (ubuntu/macos/ windows), RecommendedGlConfig() handles macOS forward-compat; examples drop hard-coded GL hints. - core: export ImVec4. - Remove per-function hand-forwarding composite module. Design: .agents/docs/2026-06-03-imgui-backend-abstraction-design.md Verified: mcpp build/test, all examples build, minimal_window runs a real window (clean framebuffer clear, no artifacts) under both clang and gcc.
Member
Author
追加:backend 抽象层 + 跨平台重构 (e2a5c0f)在原 framebuffer-clear 修复之上,按设计文档把架构重构为 模块分层
用法一致:换后端 = 改 import + 一行 跨平台: 验证
设计文档: |
- Windows uses the PowerShell xlings installer (the bash one-liner only supports Linux/macOS); Linux/macOS keep curl|bash. - All mcpp steps run under bash (Git Bash on Windows) for consistent syntax. - Linux is the required must-pass leg; macOS/Windows are continue-on-error while mcpp-index toolchain/runtime support for them settles, so they do not block CI. - mcpp.toml: use portable [toolchain] default = "llvm@20.1.7" instead of per-OS keys.
The minimal_window example lost its [toolchain] pin, so a fresh CI machine fell back to installing gcc-musl (static) as default, which cannot link the X11/GL window example. Pin all examples to default = "llvm@20.1.7" for portable, deterministic toolchain selection across platforms.
Member
Author
CI 全绿 ✅ (run 26887174718)三平台全部通过(build + test + 三个 examples 构建):
修复要点:
|
A pin is still required (an unpinned package falls back to gcc-musl static, which cannot link X11/GL), but it does not have to be llvm. Linux now builds with gcc 16; macOS/Windows keep llvm@20.1.7. Applied to the root package and all examples. Verified: gcc 16 builds the library, both test binaries, and all three examples on Linux.
A library should not dictate the consumer's toolchain. Remove [toolchain] from the package and all examples; mcpp resolves the environment/default toolchain instead. Verified locally (resolves gcc 16.1.0, lib + tests pass).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root Cause
The examples rendered ImGui draw data directly into the back buffer and swapped buffers without clearing the framebuffer each frame. Moving an ImGui window could leave stale pixels behind. The renderer backend itself should not implicitly clear because many applications render their own scene before drawing ImGui as an overlay.
Validation
mcpp testcd examples/basic && mcpp runcd examples/minimal_window && mcpp buildcd examples/glfw_opengl3 && mcpp buildThis PR is intentionally left unmerged.