Fix EGL/GLX mismatch causing blank 3D preview on Linux#12308
Conversation
- Add configurable GLEW_USE_EGL option (default OFF) to match wxWidgets - Explicitly set wxUSE_GLCANVAS_EGL=OFF for vendored wxWidgets build - Add compile-time check to detect EGL/GLX backend mismatch between GLEW and wxWidgets, preventing silent rendering failures The bug occurred when GLEW was compiled with EGL support (using eglGetProcAddress) but wxWidgets created GLX contexts. This mismatch caused OpenGL function pointers to fail loading, resulting in blank 3D model preview.
|
@mabl |
I think it should. In fact, it is my understanding that orcaslicer runs in xwayland compatibility mode - which is why it has access to GLX in the first place - and end up in that mixed EGL/GLX state. However, I did not test it (I don't run X11 anymore, at all). I don't want to give the impression that I am the top-expert on this. This on a "it works for me and this seems to be the right thing" level. |
tested with KUbuntu 25.10 with X11, it works. |
- Add configurable GLEW_USE_EGL option (default OFF) to match wxWidgets - Explicitly set wxUSE_GLCANVAS_EGL=OFF for vendored wxWidgets build - Add compile-time check to detect EGL/GLX backend mismatch between GLEW and wxWidgets, preventing silent rendering failures The bug occurred when GLEW was compiled with EGL support (using eglGetProcAddress) but wxWidgets created GLX contexts. This mismatch caused OpenGL function pointers to fail loading, resulting in blank 3D model preview. Co-authored-by: SoftFever <[email protected]>
) - Add configurable GLEW_USE_EGL option (default OFF) to match wxWidgets - Explicitly set wxUSE_GLCANVAS_EGL=OFF for vendored wxWidgets build - Add compile-time check to detect EGL/GLX backend mismatch between GLEW and wxWidgets, preventing silent rendering failures The bug occurred when GLEW was compiled with EGL support (using eglGetProcAddress) but wxWidgets created GLX contexts. This mismatch caused OpenGL function pointers to fail loading, resulting in blank 3D model preview. Co-authored-by: SoftFever <[email protected]>
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
eglGetProcAddressthat don't work with wxWidgets' GLX context, resulting in a blank 3D preview.The Fix:
GLEW_USE_EGL=OFF,wxUSE_GLCANVAS_EGL=OFF)OpenGLManager.cppto catch any future EGL/GLX mismatches at build timeThe 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