-
-
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
Backend renderer naming/filename mismatch GL versions #1900
Comments
You may be right here.
I'd be tempted to just rename the opengl2.* files to opengl1.* |
I realized the title doesn't actually reflect what I mean, so I changed it. But yes, there is a use. Not all computers have GL 3.2. I can't just require it in my application if it's not necessary, I'll be leaving a lot of users behind and pissing off a lot of people. I can't just assume everyone has it. A good example is Godot, it started requiring 3.3 and it was a disaster (they're adding 2.0 support back). But it's true that the GLSL support is a mess. I found that GL 4.5 only requires GLSL 1.40 and later to be supported, although 1.10 is often supported anyway. But it also requires GLSL 1.00, so an option would be to lower the GL 3.2 example to 3.1, and create another version for GL ES 2.0, which isn't going away anytime soon. Optionally, there could be another version for desktop GL 2.0. |
But the existing "OpenGL 2" example already full-fill that criteria. |
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
// **Prefer using the code in imgui_impl_opengl3.cpp**
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
// If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
// complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
// confuse your GPU driver.
// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API. I wouldn't want a renderer with consequences like those. And Godot's new 2.0 renderer has been in development since the beginning of this year, and it's still not ready, so it's clearly not easy. |
Regardless, if you implemented dear imgui in Godot you would want to use Godot's renderer API and not really a raw OpenGL api? |
I'm not using Godot. And this is about the GL versions of the examples, nothing to do with Godot. |
Maintaining those examples is already a crazy amount of work. I can’t be creating new ones for hypothetical situations. It’s easier for anyone to create the render loop they need in their own project than for me or anyone to create one function that save and restore every possible GL state for a given GL version. |
I don't follow. I was saying the GL 3 example only actually required GL 2 features, so there could be an identical one with a a #version 110 shader named GL 2, and the current GL 2 example could be renamed to GL 1. No need to fix the current legacy GL example. |
I may rename the GL2 to GL1. The mere changing of the GLSL version to |
@jv110 I have now pushed some changes to the GL3 code Examples+Bindings to support more version of GLSL. Unfortunately it is tricky to test widely because each drivers appears to have different support for backward compatibility, and before GL 3.0 we can't reliably request a Forward Compatible context. I think it should work now with GLSL Interested in your feedback if you have any way to test some of this. (I am still considering doing some renaming renaming after we sorted this out carefully) |
Hello @jv110, Would you be able to help testing and/or patch the code in imgui_impl_opengl3.cpp to correctly support GL 2.0/2.1 and GLSL 1.10 ? Right now we default to GLSL 1.30 what do you think of that in term of compatibility? imgui_impl_opengl3.cpp has been recently improved for WebGL 1/2. I will rename Thank you. |
I'm sorry, it had been so long, I had forgotten about all this. But sure, I can try to help. I'll try this out tomorrow. 1.30 is pretty good, and I think a lot of applications do require that, although the choice is important. My computer only supports GL 3.1 (GLSL 1.40), if that's relevant. |
I think it is a good idea to rename it to imgui_impl_opengl1 or imgui_impl_opengl_legacy (as suggested in #6154 (comment)) or similar. As far as I can tell, the imgui_impl_opengl2.cpp code only requires OpenGL 1.1 (not 1.0 though, because for example glDrawElements() requires 1.1) |
I think there's some confusion in the OpenGL example renderers. OpenGL 2.0 is where the programmable pipeline was added. The GL 3.2 renderer actually only requires GL 2.0, if you change the shader to version 1.10 (and thus, to use
attribute
,varying
andgl_FragColor
), and the GL 2 renderer doesn't use any GL 2 features. The way it is, the 3.2 requirement is completely unnecessary.The text was updated successfully, but these errors were encountered: