Add native OpenGL backends for macOS and Linux - #372
Draft
wysaid wants to merge 65 commits into
Draft
Conversation
- Accept Clang/AppleClang in CMake when EGE_BUILD_OPENGL=ON - Avoid stdint conflicts on Clang by gating bundled stdint and fixing __clang__ detection - Initialize graph state for GLFW backend and pump events to prevent startup segfault - Update PRD progress for macOS verification
…mitives - Define RenderTarget abstract interface (src/backend/interface/RenderTarget.h) covering 80+ drawing methods for full EGE API coverage - Implement GlRenderTarget (OpenGL 3.3 Core) with VBO+Shader batch rendering, FBO offscreen support, CPU/GPU sync, and basic primitives (line, rect, circle, ellipse, sector, arc, polygon, pixel) - Add GlShader utility for shader compilation/linking - Integrate GLAD 2.0 loader (OpenGL 3.3 Core profile, header-only) - Upgrade GLFWWindow to use GlRenderTarget instead of legacy immediate mode - Extend IMAGE class with m_renderTarget and m_glDirty fields - Wire screen RenderTarget to image pages in initgraph - Update egegapi.cpp drawing functions to route through RenderTarget - Suppress OpenGL deprecation warnings on macOS - Phase 3/4/5 stubs for image transfer, text rendering, and input Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 实现 GlRenderTarget 图像传输方法:blit, blitStretch, alphaBlend, alphaTransparent, withAlpha, alphaFilter, rotateBlend, rotateZoomBlend, filterBlur - 实现 CPU ↔ GPU 同步:getPixelBuffer (GPU→CPU), syncToGpu (CPU→GPU) - 添加 ROP2 模式支持:XOR, AND, OR(shader 位运算 + destination texture 采样) - 实现 rebuild() 方法用于 resize 时重建 GPU 纹理 - 将 IMAGE::putimage 全系列函数路由到 RenderTarget(OpenGL 模式) - 新增 image blit shader(顶点变换 + 片段 ROP2 + color key + alpha override) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…/measureText Implement GlRenderTarget text rendering capability using stb_truetype: - Glyph atlas texture with on-demand rasterization (1024x1024) - setFont() with face, height, weight, italic, underline, strikeout support - setTextJustify() for horizontal/vertical alignment - drawText() for both char* (UTF-8) and wchar_t* strings - getTextWidth/Height and measureText for text measurement - Escapement/rotation support for rotated text - macOS system font path resolution (PingFang, Arial, etc.) - Text rendering demo (graph_text_opengl.cpp) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Linux/macOS now default to EGE_BUILD_OPENGL=ON for true cross-platform support - mingw-w64 + wine cross-compilation deprecated with warnings - Updated BUILD.md to promote OpenGL as recommended approach - Legacy mode still available via -DEGE_BUILD_OPENGL=OFF
…port - Add captureScreenToTexture() to capture framebuffer before swapBuffers - Refactor submitBatch to create fresh VAO/VBO per batch (Core OpenGL compat) - Optimize getPixelBuffer for on-screen RT (skip GPU readback if not dirty) - Route all drawing functions in egegapi.cpp to m_renderTarget - Add OS event pumping in dealmessage for native GLFW backends - Implement getimage with OpenGL pixel readback (RT-to-RT blit + glReadPixels) - Fix macOS OpenGL context hints (retina framebuffer, doublebuffer) - Update demos to run 10 frames and save screenshots Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts: # src/graphics.cpp # src/thread_queue.h # src/time.cpp # src/window.cpp
wysaid
requested review from
FeJS8888,
Ltabsyy,
TheBadZhang,
chirsz-ever,
royqh1979,
wangxun2008 and
yixy-only
July 20, 2026 11:32
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.
What changed
Why
The previous build and runtime paths were coupled to Win32/GDI. Earlier cross-platform work could compile but did not prove pixel parity, camera lifecycle safety, or reliable process exit. The latest default-configuration test also reproduced two hidden CI gaps: an empty build type on fresh single-config builds and a Linux bundled GLFW default that required undocumented Wayland dependencies.
Impact
MERGE_READINESS_REPORT.md.Validation
git diff --check, C++ format check, and workflow YAML parse passedThe PR is intentionally draft until the latest GitHub Actions matrix is green and the remaining hardware-specific smoke tests are acknowledged.