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

GLEW initialization failed. #306

Open
misterabdul opened this issue Jun 18, 2021 · 11 comments
Open

GLEW initialization failed. #306

misterabdul opened this issue Jun 18, 2021 · 11 comments
Assignees
Labels

Comments

@misterabdul
Copy link

I have this code: https://gist.github.com/misterabdul/a44036fbc0103cab3d38319d4ce95036

And compiled like this :

cc src/main.c -o bin/main -lGLEW -lGLU -lGL -lglfw  -Wall -Wextra

But when I'm running it, it says: Failed to initialize GLEW

I'm using Fedora 34.

@nigels-com
Copy link
Owner

What's the output of glewinfo ?

@misterabdul
Copy link
Author

It's 0x4, when I pass that value to glewGetErrorString(), it says: unknown error.

@nigels-com
Copy link
Owner

glewinfo is a CLI tool that might shed some light on the available OpenGL support.

For example:

$ glewinfo -profile core -version 4.0
---------------------------
    GLEW Extension Info
---------------------------

GLEW version 2.1.0
Reporting capabilities of display , visual 0x2b
Running on a GeForce GT 1030/PCIe/SSE2 from NVIDIA Corporation
OpenGL version 4.0.0 NVIDIA 460.73.01 is supported

GL_VERSION_1_1:                                                OK
...

@misterabdul
Copy link
Author

Here's the result of my glewinfo: https://gist.github.com/misterabdul/129c51236b41ad25ad0494f81cfafcbe
It's about 5000+ lines.

@nigels-com
Copy link
Owner

That output looks healthy.

The next thing that comes to mind is X11 vs Wayland.

What is the output of glxinfo ?

@misterabdul
Copy link
Author

misterabdul commented Jun 19, 2021

I don't know if this will help or not, but here it is, the output of my glxinfo: https://gist.github.com/misterabdul/1bc4dd1a8c22ce48de089e441a0efbc6

@nigels-com
Copy link
Owner

nigels-com commented Jun 20, 2021

It's 0x4, when I pass that value to glewGetErrorString(), it says: unknown error.

Ah, interesting. So error 4 be no GLX display from glewGetErrorString, so that's a bug in my opinion.

This could be because EGL is being used by the application.
I'll have a think about how to detect if EGL is "live", and error more descriptively.

@joshuarubin
Copy link

Running into this issue as well on wayland/sway. Happy to help debug and test fixes. I don't think better wording of the error is the issue here. Or, if it is, what is the way to work around this in code?

@nigels-com
Copy link
Owner

Some breadcrumbs regarding OpenGL and Wayland.
In short, GLX depends on X11.
https://unix.stackexchange.com/questions/511134/why-wayland-is-using-opengl-es-instead-of-opengl

@nigels-com
Copy link
Owner

This looks like the reason Wayland isn't on my radar. (Nvidia GPU)
I'll scratch around to see if I have a laptop with Intel graphics.
https://www.phoronix.com/scan.php?page=news_item&px=NVIDIA-GL-VLK-XWayland

@nigels-com
Copy link
Owner

@misterabdul 's glewinfo indicates Intel GPU:

Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Intel (0x8086)
    Device: Mesa Intel(R) HD Graphics 620 (KBL GT2) (0x5916)
    Version: 21.1.2
    ```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants