Problem using GLEW #1576

Closed
opened 2018-01-27 11:04:59 +00:00 by eviatarmor · 9 comments
eviatarmor commented 2018-01-27 11:04:59 +00:00 (Migrated from github.com)

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 ...

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 commented 2018-01-27 11:10:41 +00:00 (Migrated from github.com)

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.

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.
eviatarmor commented 2018-01-27 11:11:58 +00:00 (Migrated from github.com)

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>.

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 commented 2018-01-27 11:15:31 +00:00 (Migrated from github.com)

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

Please provide a callstack. Does the stock unmodified example using gl3w works?
eviatarmor commented 2018-01-27 11:36:25 +00:00 (Migrated from github.com)

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 ()

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 commented 2018-01-27 11:44:54 +00:00 (Migrated from github.com)

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

You can compile with -g and possibly other settings to get a more readable callstack.
eviatarmor commented 2018-01-27 11:57:06 +00:00 (Migrated from github.com)

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

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 commented 2018-01-27 12:04:48 +00:00 (Migrated from github.com)

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.

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.
eviatarmor commented 2018-01-27 12:07:00 +00:00 (Migrated from github.com)

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

lol, i managed to get it working by activating the experimental version of glew. `glewExperimental = true;` before initalizing glew.
ocornut commented 2018-01-27 12:13:53 +00:00 (Migrated from github.com)

Problem solved then!

Problem solved then!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#1576
No description provided.