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

Binding openGL ES (any version) #1984

Closed
ziocleto opened this issue Jul 30, 2018 · 3 comments
Closed

Binding openGL ES (any version) #1984

ziocleto opened this issue Jul 30, 2018 · 3 comments

Comments

@ziocleto
Copy link
Contributor

Master branch

GLFW OpenGL ES (any OS)
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
OS: any
Compiler: any (currently using emscripten binding for webGL2.0 so clang 4.0+)

My Issue/Question:

First of all congrats, great lib!
I've noticed that in your binding examples there are a couple of native opengGL 2 and 3 which also supports opengl ES 2.0 and 3.0 currently:

//----------------------------------------
// OpenGL    GLSL      GLSL
// version   version   string
//----------------------------------------
//  2.0       110       "#version 110"
//  2.1       120
//  3.0       130
//  3.1       140
//  3.2       150       "#version 150"
//  3.3       330
//  4.0       400
//  4.1       410
//  4.2       420
//  4.3       430
//  ES 2.0    100       "#version 100"
//  ES 3.0    300       "#version 300 es"
//----------------------------------------   

Now the problem is that openGL ES currently don't have supports for GL_FILL_MODE and GL_POLYGON_MODE. So building imgui_impl_opengl3.cpp on a GL ES target will produce the following build errors:

imgui_impl_opengl3.cpp:118:47: error: use of undeclared identifier 'GL_POLYGON_MODE'
    GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
imgui_impl_opengl3.cpp:139:38: error: use of undeclared identifier 'GL_FILL'
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
                                     ^
imgui_impl_opengl3.cpp:226:5: error: use of undeclared identifier 'glPolygonMode'
    glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
    ^

Is this a known issue or would it be beneficial to provide a pure openGL ES binding in your example folder? I can prepare one and PR it if you need it.

Cheers,
Dado.

@ocornut
Copy link
Owner

ocornut commented Jul 30, 2018

Hello,

Is this a known issue or would it be beneficial to provide a pure openGL ES binding in your example folder? I can prepare one and PR it if you need it.

It would be beneficial however the ideal would be to have them work within the existing opengl CPP files, and most of it may already be done, see:

https://github.com/ocornut/imgui/pulls?q=is%3Apr+is%3Aopen+label%3Aopengl
Namely #1941 and #1945 which I didn't have the time to look at in details (they are fairly recently PR from 2-3 weeks ago).

I think #1941 may be right, your feedback on how to tackle this would be useful, and maybe you can check if the PR in #1941 works for you.?

The tricky part is there is seemingly no standard to handle all the #include across GL versions and platforms.

@ziocleto
Copy link
Contributor Author

ziocleto commented Jul 30, 2018

Yes sorry I've noticed that PR just now, I can confirm on our side that the proposed fix with

#ifndef EMSCRIPTEN

We've fixed it exactly like that before reading #1941 ;)

I'm not sure about the "classic" opengl include maze but I think the ifndef is quite solid IE it won't break what's not already broken ;)

The only thing about that ifndef is that it's just referring to a particular build pipeline and not a real API fix, IE we should have:

#ifdef OPENGL_ES

So maybe the correct solution is decoupling imgui_impl_opengl3.cpp but I understand that's a very big job for just 3 ifdefs so might not be worth it in the short run, surely in the long run though.

Cheers,
Dado.

@ocornut
Copy link
Owner

ocornut commented Jul 30, 2018

@ziocleto Moving this discussion to #1941, thanks!

@ocornut ocornut closed this as completed Jul 30, 2018
@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

No branches or pull requests

2 participants