2.3 KiB
Debrief: Failed Frosted Glass Implementation (Attempt 1)
1. Post-Mortem Summary
The initial implementation of the Frosted Glass effect was a catastrophic failure resulting in application crashes (RecursionError, AttributeError, RuntimeError) and visual non-functionality (black backgrounds or invisible blurs).
2. Root Causes
A. Architectural Blindness (ImGui Timing)
I attempted to use glCopyTexImage2D to capture the "backbuffer" during the _gui_func execution. In an immediate-mode GUI (ImGui), the backbuffer is cleared at the start of the frame and draw commands are only recorded during _gui_func. The actual GPU rendering happens after _gui_func finishes. Consequently, I was capturing and blurring an empty black screen every frame.
B. Sub-Agent Fragmentation (Class Scope Breaks)
By delegating massive file refactors to the generalist sub-agent, I lost control over the strict 1-space indentation required by this project. The sub-agent introduced unindented blocks that silently closed the App class scope, causing all subsequent methods to become global functions. This lead to the avalanche of AttributeError: 'App' object has no attribute '_render_operations_hub_contents' and similar errors.
C. Style Stack Imbalance
The implementation of _begin_window and _end_window wrappers failed to account for mid-render state changes. Toggling the "Frosted Glass" checkbox mid-frame resulted in mismatched PushStyleColor and PopStyleColor calls, triggering internal ImGui assertions and hard crashes.
D. High-DPI Math Errors
The UV coordinate math failed to correctly account for display_framebuffer_scale. On high-resolution screens, the blur sampling was offset by thousands of pixels, rendering the effect physically invisible or distorted.
3. Remedial Action Plan
- Abandon Fragile Capture: Stop trying to capture the backbuffer manually.
- Native OS Integration: Leverage the Windows Desktop Window Manager (DWM) via
SetWindowCompositionAttributefor stable, high-performance blur-behind. - Surgical Code Control: No more sub-agent delegation for core GUI logic. All indentation and scope changes must be manually verified.
- Unified Pipeline: Separate the "Animated Background" from the "Window Glass" logic to prevent pipeline conflicts.