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

Problem using GLEW #1576

Closed
therealcain opened this issue Jan 27, 2018 · 9 comments
Closed

Problem using GLEW #1576

therealcain opened this issue Jan 27, 2018 · 9 comments

Comments

@therealcain
Copy link

therealcain commented Jan 27, 2018

Hello,
I'm trying to compile the opengl3 example with glew, but ImGui_ImplGlfwGL3_NewFrame(); keep give me segmentation fault core dumped. i don't know what's wrong.
here is the full code: https://hastebin.com/zogobayexi.cpp ( i have changed only the headers name and gl3wInit() to glewInit() ).

and here is the makeifile: https://hastebin.com/facidepodu.rb

I've been trying to fix it for a whole day, i don't what to do, and i really want to start a project of mine with imgui ...

@ocornut
Copy link
Owner

ocornut commented Jan 27, 2018

Please provide a callstack, there's no way we can magically guess what is happening.

Does the stock unmodified example using gl3w works?
Has your copy of imgui_impl_glfw_gl3.cpp modified to also use glew and not gl3w?
gl3w and glew tasks are to retrieve OpenGL function pointers, a mismatch/lack of initialization here is likely to give you NULL function pointers.

@therealcain
Copy link
Author

therealcain commented Jan 27, 2018

i modified only the main.cpp file.
imgui_impl_glfw_gl3.cpp remain unchanged, except <GL/gl3w.h> has been changed to <GL/glew.h>.

@ocornut
Copy link
Owner

ocornut commented Jan 27, 2018

Please provide a callstack.
Does the stock unmodified example using gl3w works?

@ocornut ocornut added the opengl label Jan 27, 2018
@therealcain
Copy link
Author

therealcain commented Jan 27, 2018

the example works fine.

backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x000000000040629c in ImGui_ImplGlfwGL3_CreateDeviceObjects() ()
#2 0x000000000040670a in ImGui_ImplGlfwGL3_NewFrame() ()
#3 0x0000000000405366 in main ()

@ocornut
Copy link
Owner

ocornut commented Jan 27, 2018

You can compile with -g and possibly other settings to get a more readable callstack.

@therealcain
Copy link
Author

I compiled with -Wall and -g
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x000000000040629c in ImGui_ImplGlfwGL3_CreateDeviceObjects ()
at lib/imgui_impl_glfw_gl3.cpp:265
#2 0x000000000040670a in ImGui_ImplGlfwGL3_NewFrame ()
at lib/imgui_impl_glfw_gl3.cpp:367
#3 0x0000000000405366 in main () at main.cpp:64

@ocornut
Copy link
Owner

ocornut commented Jan 27, 2018

Then maybe use a debugger to figure out what's wrong (where it crashes)
But it most likely crash because some of the GL function pointers are pointing to zero, something to do with your gl3w/glew setup and not a problem with the actual GL code.

@therealcain
Copy link
Author

lol, i managed to get it working by activating the experimental version of glew.
glewExperimental = true;
before initalizing glew.

@ocornut ocornut changed the title imgui_impl_glfw_gl3 segfault Problem using GLEW Jan 27, 2018
@ocornut
Copy link
Owner

ocornut commented Jan 27, 2018

Problem solved then!

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