Skip to content

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

Merged
SoftFever merged 2 commits into
OrcaSlicer:mainfrom
mabl:fix/egl_glx_mismatch
Feb 15, 2026
Merged

Fix EGL/GLX mismatch causing blank 3D preview on Linux#12308
SoftFever merged 2 commits into
OrcaSlicer:mainfrom
mabl:fix/egl_glx_mismatch

Conversation

@mabl

@mabl mabl commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

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

- 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.
@SoftFever

Copy link
Copy Markdown
Collaborator

@mabl
Will it still work for x11?

@mabl

mabl commented Feb 15, 2026

Copy link
Copy Markdown
Contributor Author

@mabl Will it still work for x11?

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.

@SoftFever

Copy link
Copy Markdown
Collaborator

@mabl Will it still work for x11?

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.
Thank you

@SoftFever SoftFever merged commit bf59fe4 into OrcaSlicer:main Feb 15, 2026
12 checks passed
SoftFever added a commit that referenced this pull request Feb 15, 2026
- 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]>
tome9111991 pushed a commit to tome9111991/OrcaSlicer that referenced this pull request Feb 24, 2026
)

- 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants