-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Configurable OpenGL loader in the example bindings #2001
Comments
I agree we should do that. I think it would be nice to have explicitly named defines for the most-common 3/4 loaders and then a _CUSTOM version that does the include.
And it would need to default to something (GL3W probably. The main.cpp in examples/ would also need to perform the initialization call for those common 3/4 loaders. Let me know if you want to work on a PR for it, that would be helpful. Thanks, |
I think it's probably enough to have a "custom" override, but we can do as you suggest. I mean the user probably already knows how to initialize their OpenGL loader, so I'm not sure if it's worth putting it into the I can work on a PR for this, but can only test on the Linux side. |
If the questions posted on this Issue Tracker are any indication, lots of users are confused by most of the code involved in the back-ends. C++ is a tough ecosystem and OpenGL is messy (the loader situation itself being a good reminder of that). So generally, making things as obvious and clear as possible is valuable to reduce further support requests. See #1988 for example.
That would be great, then I'll do some testing on Windows. |
Ok no prob, we can write loader code for glad/gl3w/glew :D |
(Do you want glext as well?) |
As many as possible provided they are mostly all one-liners (~1 line of include, ~1 of init) and not totally obscure. To clarify, we won't provide the code/library for them in the repository, so those lines are only provided as reference. Since you have to do some of it for your testing, I guess it wouldn't hurt to add comments e.g. in the Makefile describing the typical gcc/clang command-line options associated to a loader (both the -I and the -D part) but that's not mandatory. When we include cmake/premake files in the repo we'll include something to facilitate their use (even if it's just comments!). |
Ok I've open a PR with a WIP changes so we can comment on this. One thing I've noticed with the glfw+opengl3 example: right now, |
Yes, this is fine and more than enough. We can perfectly add more later if someone mentions something.
Correct. My suggestion is to ignore the sdl+opengl3 main.cpp for now. When we are happy with the change you or I can replicate them at the end.
Good point, it was discussed in #1985 and #1941 (comment), and I think that @ziocleto PR was faulty (see my last comment in #1985) and should be reverted. Instead my suggestion would to be to keep the #ifdef GL_SAMPLER_BINDING and then also test for the function pointer inside that block, and see if it work with those loaders. Then we need to add |
Yes we have warnings as errors everywhere, so if it's impracticable to detect if that function is defined and evaluating opengl es version is tricky then ignoring that warning but keeping the if should work. |
(
Mildly derailing the topic here, I am always surprised that people use such aggressive warning settings for _third-party_ code. Surely you are not going to fix everyone’s else code, why not restrict those settings to your own code?
GCC in particular likes to add new doses of warnings every version, it’s not practical to submit third-party repos code which may be stable/unchanging to those ever-evolving requirements.
)
|
[OT] We usually link external libs as system libs so we do not have to worry about warnings as errors when building our source code. But for dear imgui I was just trying to play with it and noticed it won't compile ;) I didn't know what your build pipeline policies were :). Generally I agree especially with GCC warnings some times are a PITA but it's also good practice IMO to at least know what they are because most often than not they can masquerade problems with your code. [OT2] I saw you worked in Guildford I've worked there on the studio across the road for 10 years also ;) |
[OT] Don’t get me wrong, I also have a zero-warning policy on most project. In the particular case if imgui it’s tricky to allow users to compile with modern pedantic warnings as they tend to warn for stylistic things that we have choosen (C style cast) or things which are required for compatibility with older compilers (imgui in theory compiles with C++03, thought I am tempted to raise the bar to Visual Studio 2012 level of C++11 compat as we would benefit from a few things such as eg: forward defined enums).
I am always interested in warning reports (in a new thread!) even if it means we take the decision to ignore warning xx in imgui codebase, at least the user doesn’t have to be bothered by it.
(Not sure _which_ studio accross the road, there were several, but hi!)
|
Closing this (merged #2002). |
Just throwing my 2 cents in. I setup the loader via https://cmake.org/cmake/help/latest/command/add_compile_definitions.html#command:add_compile_definitions add_compile_definitions(IMGUI_IMPL_OPENGL_LOADER_GLEW) |
Hi there,
In order to be able to use the example bindings as is (GLFW + OpenGL 3 as far as I am concerned), I'd suggest to make the OpenGL loader configurable (e.g. via a macro
IMGUI_OPENGL_LOADER
). For example, inimgui_impl_opengl3.cpp
, you could have something along the lines of:The text was updated successfully, but these errors were encountered: