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

Examples: add glad for OpenGL 3.3 core #2785

Closed
wants to merge 1 commit into from

Conversation

NeroBurner
Copy link
Contributor

add glad files for examples to use

previous discussion in #2774

@ocornut
Copy link
Owner

ocornut commented Sep 17, 2019

In the other topic, your reasoning for adding Glad was:

" the glad loader was the only one I had modify the project (download glad sources and put them in the right folder). gl3w is already in the repository, and glew is used from system. I thought with glad in the repo the makefile has equal support for all three cases (just comment out the current and comment in another loader) "

That's all true, but if gl3w works why considering to use Glad?
And if user is already using Glad, since it means they already have it somewhere?

@o-micron
Copy link

o-micron commented Sep 22, 2019

Hey, I made a pull request today that will settle the gl loader headers forever, this will allow imgui to automatically use your existing gl loader header without making changes in your engine/project .... #2798

Probably that's what you are searching for ...

@ocornut
Copy link
Owner

ocornut commented Sep 22, 2019

I think your merged fixed @o-micron doesn't invalidate this PR, what @NeroBurner suggests is that Glad is not part of standard packages so they suggested including it in the repo.

@o-micron
Copy link

@ocornut I thought that would help in case we want to use glad with imgui ... Now that we can automatically use whatever gl loader headers included in the original project, we can use glad without adding glad to standard packages ... 🙂

Sorry, I don't mean to invalidate this PR or anything like that, I just wanted to help 🙂

@NeroBurner
Copy link
Contributor Author

That's all true, but if gl3w works why considering to use Glad?
And if user is already using Glad, since it means they already have it somewhere?

I find the flow with glad better. You decide exactly which minimum OpenGL version you want to support (version, core/compatibility, selected extensions), download and add it to your project (or generate it with the python script yourself)

the glad version added to the examples would only be for the examples (or if someone wants to use the OpenGL 3.3 Core version). I personally used it to test if my project did something wrong or the fault lies at imgui (in my case it was my project 😅 ). Having a working version of glad in the example folder makes it easier to test the different loaders (if needed)

@ocornut
Copy link
Owner

ocornut commented Sep 23, 2019

I think Glad is great and probably a better solution for end-user.
Within our repo using gl3w has the advantage of letting us tweak GL profiles without modifying the repo (as anything GL is of incredible complexity to maintain for dear imgui, quickly verifying compatibility can be helpful).

If we include Glad in the repo we may raise the issue that people will come up with infinitity of pull requests to tweak the Glad output to whichever version they end up using in their project.

I think you can generate Glad without the KHR stuff and that's lighter.

@NeroBurner NeroBurner force-pushed the example_add_glad_files branch from 50649f2 to 84e8abb Compare September 23, 2019 09:07
@NeroBurner
Copy link
Contributor Author

removed the KHR part in glad

the PRs may come, but we could add a remark in the issue template for that case, or somewhere in the readme 🤔

if you think the possible drawbacks outweigh the benefits just close the PR, no hard feelings :)

@NeroBurner
Copy link
Contributor Author

just tested glad loader again with example_glfw_opengl3 and there is a compile error without the KHR part in glad. Just showing the first one

[nero@burner-tux example_glfw_opengl3]$ make
g++ -I../ -I../../ -g -Wall -Wformat -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD `pkg-config --cflags glfw3` -c -o main.o main.cpp
In file included from main.cpp:19:
../libs/glad/include/glad/glad.h:93:9: error: ‘khronos_int8_t’ does not name a type
   93 | typedef khronos_int8_t GLbyte;
      |         ^~~~~~~~~~~~~~

I think I have to re-add the KHR part of glad

@NeroBurner NeroBurner force-pushed the example_add_glad_files branch 2 times, most recently from 03b33b0 to b032a8c Compare September 24, 2019 17:55
@NeroBurner NeroBurner force-pushed the example_add_glad_files branch from b032a8c to 5c434b7 Compare October 2, 2019 20:37
@NeroBurner NeroBurner force-pushed the example_add_glad_files branch from 5c434b7 to 1c58214 Compare October 14, 2019 09:06
@ocornut ocornut changed the title examples: add glad for OpenGL 3.3 core Examples: add glad for OpenGL 3.3 core Jan 6, 2020
@ocornut
Copy link
Owner

ocornut commented Dec 9, 2020

Closing this as won't merge. I think at this point we don't need to add more libs than strictly necessary for the examples.

Both Glad and Glad2 are supported by the OpenGL thought, but we'll leave it to user to provide their copy of Glad.

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

Successfully merging this pull request may close these issues.

3 participants