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

Support for OpenGL ES 2.0 #2393

Closed
wants to merge 2 commits into from
Closed

Conversation

rmitton
Copy link
Contributor

@rmitton rmitton commented Mar 2, 2019

This PR extends the OpenGL backend to add support for OpenGL ES 2.0. The VAO feature the existing 3.0 backend uses is not strictly required, so can simply be #ifdef'd out in this case.

(the previous code required ES 3.0, which some desktop implementations do not support)

The current code requires OpenGL ES 3.0. With the addition of a few small #ifdefs, v2.0 can be supported as well.
@rmitton
Copy link
Contributor Author

rmitton commented Mar 2, 2019

I just noticed the following PR also covers this issue. I suspect this patch is simpler. Not sure whether to cancel my one or not.
#2351

(note that this code also requires IMGUI_IMPL_OPENGL_LOADER_CUSTOM to be set to <GLES2/gl2.h>)

@ddovod
Copy link

ddovod commented Mar 2, 2019

+1
I'm just trying to find a way to disable vao in imgui code so it can be used on macOS with opengl2 context with shaders, and vao is the only showstopper

@ocornut
Copy link
Owner

ocornut commented Mar 3, 2019

Thanks a lot Richard,

I just noticed the following PR also covers this issue. I suspect this patch is simpler. Not sure whether to cancel my one or not.

Unfortunately right now the other PR is in a barely usable state (lots of off-topic cruft and looks like an accidental attempt to hide the signal inside maximum amount of noise).

I am a surprised that just commenting out the VAO code makes it work, I must misunderstand GL but haven't dug into it, anyway it is great that we have a second and explicit confirmation about it!

I've got the right amount of information in this PR to proceed forward.

(the previous code required ES 3.0, which some desktop implementations do not support)
(note that this code also requires IMGUI_IMPL_OPENGL_LOADER_CUSTOM to be set to <GLES2/gl2.h>)

Could you clarify which implementation do or do not support ES 3.0?
GL back-ends have been a never-ending source of entangled troubles so I would like to gather and log every piece of explicit information I can.

Do you think we could rework the top part of the .cpp file to detect ES2 systems the same way we attempt to detect ES3? And therefore completely bypass the IMGUI_IMPL_OPENGL_LOADER_xxxx bits.

// iOS, Android and Emscripten can use GL ES 3
// Call ImGui_ImplOpenGL3_Init() with "#version 300 es"
#if (defined(__APPLE__) && TARGET_OS_IOS) || (defined(__ANDROID__)) || (defined(__EMSCRIPTEN__))
#define USE_GL_ES3
#endif

I think we should transition to a more explicit #define model like #2351 is using but at the same time do everything we can to default to the right GL header without custom defines.

I'll rework this and try to make a commit soon so don't worry about tweaking the PR now, but would appreciate help on the question above.

Thanks a lot!

@rmitton
Copy link
Contributor Author

rmitton commented Mar 3, 2019 via email

@ocornut
Copy link
Owner

ocornut commented Mar 3, 2019

Thank you.
I now have merged a similar set of changes (see beb3062, forgot to tag the issue in the commit message)

It is currently using an explicit #define IMGUI_IMPL_OPENGL_ES2.

@ocornut ocornut closed this Mar 3, 2019
@ocornut ocornut mentioned this pull request Mar 3, 2019
@rmitton rmitton deleted the opengles_2_0 branch March 4, 2019 20:47
@ocornut ocornut added the web label Jul 8, 2021
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