Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear how to use glew with EGL / Missing early no-EGLDisplay init #372

Open
vvuk opened this issue Oct 21, 2022 · 3 comments
Open

Unclear how to use glew with EGL / Missing early no-EGLDisplay init #372

vvuk opened this issue Oct 21, 2022 · 3 comments

Comments

@vvuk
Copy link

vvuk commented Oct 21, 2022

I'm not sure I see what the right path is to using GLEW with EGL. Can't call glewInit() at the start, because it wants to call glewContextInit but there's no GL context yet. eglewInit(dpy) can't be used, because you don't yet have a EGLDisplay. And eglGetDisplay can't be used to get one, because the __eglewGetDisplay pointer has not been initialized yet.

Seems like there's something like an eglewEarlyInit (or even eglewInit(EGL_NO_DISPLAY)) missing that initializes the function pointers for the functions that can be called even before EGL initialization, such as eglGetDisplay -- as well as extensions that can be used before init, such as EGL_EXT_device_enumeration and EGL_EXT_platform_base (in order to call eglQueryDevicesEXT + eglGetPlatformDisplayEXT).

A workaround that seems to be ok is to just manually init the specific functions you need:

    __eglewQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC) eglGetProcAddress("eglQueryDevicesEXT");
    __eglewGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC) eglGetProcAddress("eglGetPlatformDisplayEXT");

(or the same for __eglewGetDisplay), and then calling eglewInit(dpy) with the dpy that you're able to obtain. But it's a bit messy/magic to have to know that.

(Even more annoyingly, but not GLEW's fault... for some reason EGL_EXT_device_enumeration, device_query, etc. are missing from the EGL extensions string with nvidia's drivers on Linux, but eglGetProcAddress finds their entry points fine.)

@nigels-com
Copy link
Owner

I'm not hands-on with EGL personally. What you're saying here sounds right, looking at the implementations of glewInit and eglewInit. Room for improvement indeed.

@vvuk
Copy link
Author

vvuk commented Oct 21, 2022

I'll see if I can take a swing at this as part of my current project; I think even just getting a path for eglGetDisplay would be a big help

@gedalia
Copy link

gedalia commented Feb 21, 2024

I just noticed the same thing, did this ever improve?

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

No branches or pull requests

3 participants