-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
ImGui_ImplOpenGL3_init() returns a segfault with GLEW #4279
Comments
Is the imgui_impl_opengl3 backend compiled to use Glew and not gl3w?
// ~~I just realized that adding the call here defeat the helper debug/test code added between line 230 and 270 to help people detect that the right loader is used. I will move them in the other order.~~
|
Hello, Can't strikeout the second sentence from my previous message (messages sent via email don't have markdown marketing) but you can ignore the second sentence. Can you check the value of local variable Linking to #4170 |
@ocornut Printing gl_loader shows that it does detect it as GLEW and not GL3W |
You need to use the right define so it that cpp will use glew then.
|
I will amend the commentary around that section with: const char* extension = (const char*)glGetStringi(GL_EXTENSIONS, i); // IF YOU GET A CRASH HERE: READ ABOVE. "Above" refer to: // Make an arbitrary GL call (we don't actually need the result)
// IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by THIS FILE.
// Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above.
// Check the value of the "gl_loader" variable and confirm it is the same as the loader you intended to use.
GLint current_texture;
glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture); You can add |
Adding that define doesn't fix the issue, I'm using GLEW which means that it detects the right openGL loader |
Can you confirm you are getting that crash and the value for gl_loader says “glew” and NOT anything else? |
I'm not the author of the issue, but have the same crash in the same point in my code. My debugger prints gl_loader as "GLEW", not "glew", could that be that the problem?. I'll list all the variables that I assume are relevant (I really new to OpenGL and ImGui, so please correct me if I'm wrong):
The exact versions of glew and glfw that I use are the following: https://github.com/Perlmint/glew-cmake/tree/883e35a3d493d93fa27da5abb6225654c360f9d0 The exact error that I see is the following:
I also have all the initialization glfw and glew code in a shared library that I then use in my Please tell me if I can do anything else. |
Ok so after testing a little more, I've found that the exact same code works fine when compiling with GCC on Pop_os and doesn't work on VS2019 on windows, compiles, but crashes when running. I am now sure the problem is not imgui, so I'll leave it here. Thank you :) |
@mayuso Could you step in with a debugger and tell exactly which function call is crashing? |
Ok, I've gone step by step and my problem wasn't actually |
Version/Branch of Dear ImGui:
imgui/1.83
glfw/3.3.4
glew/2.2.0
all pulled from Conan
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: clang(++)
Operating System: archlinux
My Issue/Question:
ImGui_ImplOpenGL3_init(); gives a segmentation fault when called
Main.cpp
output:
'output/Debug/amalgam' terminated by signal SIGSEGV (Address boundary error)
output from lldb:
The text was updated successfully, but these errors were encountered: