glew
glew copied to clipboard
glewInit() failes with EGL, returning GLEW_ERROR_NO_GLX_DISPLAY
Hi,
We're using GLEW 2.2.0 built with EGL support to test our software on the CI, using llmpipe renderer for offscreen rendering. To do so, we had to build glew with EGL enabled.
Headless testing is fine on our computer locally.
On the CI (for instance CircleCI), glewInit() failes :
if(GLenum err = glewInit(); GLEW_OK != err ) {
returning the error code GLEW_ERROR_NO_GLX_DISPLAY
.
This is totally expected, since we're running headlessly without any X server (whereas there exists one on our developpement computer, that's why it wasn't triggered).
Actual hack is to ignore this error :
if(GLenum err = glewInit(); GLEW_OK != err && err != GLEW_ERROR_NO_GLX_DISPLAY) {
Then everything runs smoothly on the CI.
IMPO, I do think this error code shouldn't exists when running EGL as this is something we can encounter when using EGL.
Cheers,
See also:
https://github.com/flathub/io.github.endless_sky.endless_sky/issues/1 https://github.com/endless-sky/endless-sky/pull/5217 https://github.com/endless-sky/endless-sky/pull/5230
My first impression is that building GLEW with -DGLEW_EGL ought to resolve this.
Lenum GLEWAPIENTRY glewInit (void)
{
GLenum r;
#if defined(GLEW_EGL)
PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL;
#endif
r = glewContextInit();
if ( r != 0 ) return r;
#if defined(GLEW_EGL)
getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay");
return eglewInit(getCurrentDisplay());
#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
return r;
#elif defined(_WIN32)
return wglewInit();
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
return glxewInit();
#else
return r;
#endif /* _WIN32 */
}
Is the root problem here both GLX and EGL modes are supported by the application?
So? Is this fixed?
building GLEW with -DGLEW_EGL ought to resolve this.
Hi @nigels-com
Huge apologies for my late reply, got very busy at work since the beginning of the year..
Actually, we're building manually glew using this:
cd glew-2.2.0 && make SYSTEM=linux-egl install.all && cd ..
ln -s /usr/lib64/libGLEW.so.2.2 /usr/lib/libGLEW.so.2.2
I'd expect to avoir these errors as linux-egl
is specified. Is this build method deprecated ?
Again, apologies for this late reply
Cheers