-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
compile error in example if IMGUI_IMPL_OPENGL_LOADER_CUSTOM is defined #2178
Comments
Hello, What do you expect should happen or be done? The examples’ main.cpp can’t implement initialization for an unknown loader. This define makes sense to use the imgui_impl_opengl3 file in your own code, how are you trying to use it here? |
I started OpenGL programming by copying another project on github and modifying it. As a result, my code doesn't use a loader library, because the project I copied doesn't. I just ask GLFW to include the OpenGL headers for me, with no loader library. My custom header does this:
I modified
to this:
and everything works fine on Linux. The ImGui example works, and my code that uses ImGui also works. The new code also looks more correct from a pure programming perspective, since the variable I didn't bother to learn about OpenGL loader libraries until now. Somehow I've managed to work on my project for several years without having this knowledge. Now that I've researched the topic, I see claims that just including the opengl headers doesn't work; you need to use a loader library. I use OpenGL3 with shaders, so my code shouldn't work as written. I'm going to make a guess that this claim is more true on Windows and MacOS than it is on Linux. If you are saying that ImGui requires a loader, and that using OpenGL without a loader is not supported by the ImGui examples, then just close this issue. I'm going to try and modify my project to use GLAD, since that appears to be the most popular loader. |
…NGL_LOADER_CUSTOM (may be missing init). (#2178)
You are right here, it's just that I didn't expect the examples/ main.cpp file to ever compile as-is with any other loaders (when using IMGUI_IMPL_OPENGL_LOADER_CUSTOM). But at it happens, There's some friction to provide a IMGUI_IMPL_OPENGL_LOADER_GLEXT out of the box: glext.h is not available by default under Windows, and gl.h+glext.h tend to requires specific os-related included which would increase the size of the include blocks in main.cpp and _opengl3.cpp - but that's possible to do later, I just need to investigate it a little further. Basically we need to be copying what's done in |
For the records, here's a block to add in main.cpp/imgui_impl_opengl3.cpp to use glext without GLFW. It's only tested under Windows however.
|
Thanks @ocornut. |
Version/Branch of Dear ImGui:
Version 1.65 :
Back-end file/Renderer/OS: (or specify if you are using a custom engine back-end)
Back-ends: imgui_impl_opengl3.cpp, imgui_impl_glfw.cpp
OS: Ubuntu 16.04
Compiler: gcc 5.4.0
My Issue/Question: (please provide context)
examples/example_glfw_opengl3/main.cpp
fails to compileif
IMGUI_IMPL_OPENGL_LOADER_CUSTOM
is defined.The problem is here:
If
IMGUI_IMPL_OPENGL_LOADER_CUSTOM
is defined,then none of
IMGUI_IMPL_OPENGL_LOADER_{GL3W,GLEW,GLAD}
are defined,thus the local variable
err
is not defined,and thus you get a compile time error:
I suspect that the bug was introduced with the changes for #2001.
The text was updated successfully, but these errors were encountered: