-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Backends: OpenGL3: Add compatibility of GL_VERSION for GL 2.x #6154
Conversation
Hello, |
Hang on. |
…t#6154) GL_MAJOR_VERSION and GL_MINOR_VERSION are available on GL 3.0 and above. So we have to parse GL_VERSION under GL 2.x Reference https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries Regressed since 459de65 See ocornut#3530
Accompanying pull request overthere: dearimgui/gl3w_stripped#2. Additionally, I had missed the minimum version check in |
GL_MAJOR_VERSION and GL_MINOR_VERSION are available on GL 3.0 and above. So we have to parse GL_VERSION under GL 2.x Reference https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries See ocornut/imgui#6154
…gui#2) GL_MAJOR_VERSION and GL_MINOR_VERSION are available on GL 3.0 and above. So we have to parse GL_VERSION under GL 2.x Reference https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries See ocornut/imgui#6154
p.s. I notice that the original project gl3w_stripped was forked from only intended to provide access to the OpenGL core profile specification (introduced in OpenGL 3.2, as I understand it — sorry not an OpenGL whiz). However ImGui supports OpenGL 2.x as well, and depends on imgui_impl_opengl3_loader.h even if we use a different loader (in our case, SDL2). Maybe instead of taking this approach of modifying gl3w, |
I am not sure I understand your suggestion. If the current change works for you I'm fine with it. Can you describe your setup where this is needed? |
The OpenGL 2 and 3 backends are separate. Unless I'm missing something |
There is a mislabeling but I believe OpenGL 2.0 contexts should be able to use imgui_impl_opengl3.cpp |
(Edit: Omar sniped me, this wasn't where the misunderstanding came from.) Maybe never mind my earlier comment, I see now from looking at the older PR mentioned that this fix is intended for OpenGL ES 2.0.
The core profile mainly just deprecates ancient functionality, I don't think it's meaningfully different from the perspective of what Dear ImGui is using in the backends. |
@PathogenDavid Right at the top of
So hence my assumption this backend is supposed to support OpenGL 2.x as well. At least historically it did, but maybe it changed, and comments be comments do tend get out of date. For context, someone from an emulator project that I contribute to is experimenting adding Dear ImGui to it. The emulator’s OpenGL backend currently uses OpenGL 2.1 (with shaders, not fixed function), although it has provisions for optionally changing to 3.x or ES x.x (something that’s being considered). As far as I understood they followed a tutorial to get started. It works on their Linux PC, but on my Mac it fails on that version number check, and I can make it work by making this modification. But of course although I have had some cursory encounters with Dear ImGui in the past, I am far from an expert on its code base, so that’s why I was wondering whether this was the right approach. |
@grauw No I think you and that comment are right, I had in my head it wasn't supposed to be compatible. If this is the only thing wrong with it this is definitely a sensible fix. |
Yes I understand it better now too, also with the context of the older issue that @ocornut referred to. The "gl2" backend is intended for the fixed function pipeline (legacy) while the "gl3" is intended for the shaders pipeline (core). And it is probably somewhat confusingly named "gl3" in gl3w because the concept of the core profile was introduced in OpenGL 3, but it equally applies to the shaders pipeline subset of OpenGL 2, so it makes sense for gl3w to also support that. An additional complicating / confusing factor is that on Apple’s OpenGL implementation apparently you can use GL 2 only in compatibility mode, whereas GL 3 can only be used in core mode. But in the end that doesn’t matter as long as you stick to using only the specific subset appropriate for the pipeline of choice. Anyway, given that, ignore my thoughts about |
GL_MAJOR_VERSION and GL_MINOR_VERSION are available on GL 3.0 and above. So we have to parse GL_VERSION under GL 2.x Reference https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries See ocornut/imgui#6154 Co-authored-by: Laurens Holst <[email protected]>
Merged as b0c1816, thank you ! |
This includes Grauw's fix: ocornut/imgui#6154
GL_MAJOR_VERSION and GL_MINOR_VERSION are available on GL 3.0 and above. So we have to parse GL_VERSION under GL 2.x Reference https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries See ocornut/imgui#6154 Co-authored-by: Laurens Holst <[email protected]>
GL_MAJOR_VERSION and GL_MINOR_VERSION are available on GL 3.0 and above. So we have to parse GL_VERSION under GL 2.x
Reference https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries
Regressed since 459de65
See #3530