How thatmg393-2/fogltlogles works
Project type and purpose
• This is a C++ “translation layer” library whose job is to let an application written to the OpenGL API run on OpenGL ES 3.2 drivers. It wraps, adapts, and translates desktop-GL calls (and shaders) into GLES calls. It bundles third-party shader tooling (Shaderc, SPIRV-Cross), and provides its own state-tracking, binding, and command-translation logic.
File structure
• Top-level:
• / : public headers for EGL, GL, GLES variants, shader interfaces, utilities
• src/ : implementation grouped by API surface (egl/, gl/, gles/, gles20/, gles30/, gles32/)
• deps/ : embedded third-party repos (shaderc, spirv-cross)
• tools/ : auxiliary utilities (clangd config)
• build scripts (CMakeLists.txt, build.sh), devcontainer and CI config
• Patterns:
• Adapter/Wrapper pattern: each GL entry point is re-implemented and forwarded to GLES equivalents
• State-tracking modules: track buffers/textures/framebuffers for GLES limitations
• Shader pipeline: preprocess, compile (Shaderc), cross-compile (SPIRV-Cross), postprocess
README for insights
• Confirms it’s a “Fast OpenGL Translation Layer to OpenGL ES”, proof-of-concept, relies on GLES 3.2, uses Shaderc and SPIRV-Cross.
Final advice
• Shader translation pipeline end-to-end
• Both build-time (CMake/Shaderc/SPIRV-Cross) and run-time (API interception, state tracking, actual GLES calls)
• Don’t overthink: a clear separation into Application → FOGLTLOGLES → GLES Driver plus Shader Pipeline is sufficient