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

"Failed to initialize OpenGL Loader!" After properly initializing opengl functions #7747

Closed
pinkoboio opened this issue Jun 28, 2024 · 2 comments

Comments

@pinkoboio
Copy link

Version/Branch of Dear ImGui:

Version 1.90, Branch: master

Back-ends:

imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp

Compiler, OS:

g++, NixOS 23.11

Full config/build information:

No response

Details:

Why does this code result in a "Failed to initialize OpenGL Loader!" error?

I have a very basic opengl program, it uses opengl version 3.0 and before adding imgui everything worked perfectly fine. I added the following code to my program to initialize imgui:

IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
ImGui_ImplGlfw_InitForOpenGL(Graphics::window, true);
ImGui_ImplOpenGL3_Init();

and I also added the following code to the end of my application loop:

ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::ShowDemoWindow();

When I run the program I get the following output:

Failed to initialize OpenGL loader!
zsh: segmentation fault (core dumped)

I've looked online to see if others have encountered this issue, and I've found two issues that most closely resemble mine. The first poster forgot to initialize glad before they called ImGui_ImplOpenGL3_Init() and the second poster's hardware just had dodgy opengl3 support. Thing is I know my hardware is opengl3 compatible, I've been working on this opengl program for a while and never experienced any difficulty with opengl compatibility.

My initial thought of what could be causing the issue would be the fact that I'm running NixOS, and the fact that NixOS doesn't adhere to the filesystem standard.(?) That seems like a stretch though, I don't truly know what could be causing my problem at this point. I was hoping to be able to depend on ImGUI to move forward with the development of my project, so any amount of guidance would be appreciated.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

@ocornut
Copy link
Owner

ocornut commented Jun 28, 2024

We made a fix in 1.90.6 which may be the fix for you: #7562
Commit 0d483a1

@pinkoboio
Copy link
Author

That commit did fix my issue, ImGui works as expected now. I'll close this issue now, thanks :]

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

No branches or pull requests

2 participants