From 83fccd0835b99144298a1f2efc13c0ba8717276c Mon Sep 17 00:00:00 2001 From: catsout Date: Tue, 18 Oct 2022 20:33:58 +0800 Subject: [PATCH] SDL: fix glew on wayland by ignore glx glXGetProcAddress works on wayland if linking with x11. As long as we don't use glx related funcs, no_glx_error can be ignored. SDL should handle the no_glx_error brefore glewInit. Glew is only used to init gl funcs. related: https://github.com/nigels-com/glew/issues/172 --- SDL/SDLGLGraphicsContext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SDL/SDLGLGraphicsContext.cpp b/SDL/SDLGLGraphicsContext.cpp index 492005a1f4..945c9a950e 100644 --- a/SDL/SDLGLGraphicsContext.cpp +++ b/SDL/SDLGLGraphicsContext.cpp @@ -394,7 +394,9 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int mode, std: if (gl_extensions.IsCoreContext) { glewExperimental = true; } - if (GLEW_OK != glewInit()) { + GLenum glew_err = glewInit(); + // glx is not required, igore. + if (glew_err != GLEW_OK && glew_err != GLEW_ERROR_NO_GLX_DISPLAY) { printf("Failed to initialize glew!\n"); return 1; }