Fix EGL/GLX mismatch causing blank 3D preview on Linux #753

Closed
opened 2026-04-05 16:28:42 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @mabl on 2/15/2026

Description

Fixes blank 3D preview on Linux caused by an EGL/GLX backend mismatch.

The Problem:
GLEW and wxWidgets must use the same OpenGL backend (both EGL or both GLX). When they disagree, OpenGL function pointers are loaded from one backend but called against a context from the other, resulting in empty rendering.

On Linux systems where EGL is available, GLEW auto-detects and enables EGL support while wxWidgets defaults to GLX. This mismatch causes GLEW to load functions via eglGetProcAddress that don't work with wxWidgets' GLX context, resulting in a blank 3D preview.

The Fix:

  • Explicitly configure both GLEW and wxWidgets to use GLX (GLEW_USE_EGL=OFF, wxUSE_GLCANVAS_EGL=OFF)
  • Add compile-time checks in OpenGLManager.cpp to catch any future EGL/GLX mismatches at build time

The compile-time checks also protect against distributions that unvendor dependencies and provide system libraries with mismatched EGL/GLX support.

Screenshots/Recordings/Graphs

N/A - Fixes rendering on affected Linux systems; no UI changes.

Tests

  • Verified fix resolves blank 3D preview on Linux systems with EGL available
  • Compile-time static assertions prevent future backend mismatches
*Originally created by @mabl on 2/15/2026* ## Description Fixes blank 3D preview on Linux caused by an EGL/GLX backend mismatch. **The Problem:** GLEW and wxWidgets must use the same OpenGL backend (both EGL or both GLX). When they disagree, OpenGL function pointers are loaded from one backend but called against a context from the other, resulting in empty rendering. On Linux systems where EGL is available, GLEW auto-detects and enables EGL support while wxWidgets defaults to GLX. This mismatch causes GLEW to load functions via `eglGetProcAddress` that don't work with wxWidgets' GLX context, resulting in a blank 3D preview. **The Fix:** - Explicitly configure both GLEW and wxWidgets to use GLX (`GLEW_USE_EGL=OFF`, `wxUSE_GLCANVAS_EGL=OFF`) - Add compile-time checks in `OpenGLManager.cpp` to catch any future EGL/GLX mismatches at build time The compile-time checks also protect against distributions that unvendor dependencies and provide system libraries with mismatched EGL/GLX support. ## Screenshots/Recordings/Graphs N/A - Fixes rendering on affected Linux systems; no UI changes. ## Tests - Verified fix resolves blank 3D preview on Linux systems with EGL available - Compile-time static assertions prevent future backend mismatches
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#753