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

Emscripten fix #116

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Jonathhhan
Copy link

@Jonathhhan Jonathhhan commented Dec 2, 2022

With adding #include "stack" to ImHelpers.h (and a few small additional changes) it works also with Emscripten.

@Daandelange
Copy link
Collaborator

Hey, Thanks for your PR. Have you seen the develop branch ? We're planning to transition to that branch. It should support Emscripten too. I'd love to know if it works on Emscripten.

@Jonathhhan
Copy link
Author

Jonathhhan commented Mar 21, 2023

@Daandelange I tried the develop branch, and it seems to be more complicated to make it work.
First I had to add the GLES includes to EngineOpenFrameworks.h, but then I still get this error:

wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl3.o: undefined symbol: glPolygonMode
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl3.o: undefined symbol: glPolygonMode
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glGetTexEnviv
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glPushAttrib
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glTexCoordPointer
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glColorPointer
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glDisableClientState
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glDisableClientState
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glDisableClientState
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glPopMatrix
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glPopMatrix
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glPopAttrib
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl3.o: undefined symbol: glPolygonMode
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl3.o: undefined symbol: glPolygonMode
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glShadeModel
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glTexEnvi
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glEnableClientState
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glEnableClientState
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glEnableClientState
wasm-ld: error: /home/jonathan/Desktop/of_v20230320_linux64gcc6_release/addons/obj/emscripten/Release/ofxImGui/libs/imgui/backends/imgui_impl_opengl2.o: undefined symbol: glDisableClientState
wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

But I am sure it will work with the right changes (because it does work well with the master branch).
Here you can try the demo example (compiled with my fork of the master branch and the current OF and Emscripten): https://ofximgui.handmadeproductions.de/

@Daandelange
Copy link
Collaborator

Hi, thanks for giving it a try. :)
These errors are GLES2 symbols that I bypassed by injecting GLES1 hacks, you probably need that include too, you're probably missing a macro condition to include it. ImGui doesn't support GLES1, OF does.
Weird that imgui_impl_opengl3.cpp also throws one error, I only had them in imgui_impl_opengl2.cpp

Look in ofxImGuiConstants.h if the correct macros are defined.
I'll be able to help deeper within a few weeks.

@Daandelange
Copy link
Collaborator

Hi, did you make any progress on this ?

@Jonathhhan
Copy link
Author

Jonathhhan commented Jul 28, 2024

Hi, sorry. I did not make any progress with that. But for another project I created SWIG bindings for ofxImGui (not related to the Emscripten stuff). I will come back to the issue, eventually (I make a short summer programming break at the moment...).

@danoli3
Copy link

danoli3 commented Aug 1, 2024

I did look into this as I had some GL errors in one of the builds with particular Makefile settings for the new libraries and Version of Emscripten.

If possible ImGui update to latest just out this week and I'll look at the bindings as it solves

@Daandelange
Copy link
Collaborator

@danoli3 Would you like me to update ImGui or are you on it ? (see Updating ImGui)
Also note that the GLES1 hacks mentioned above are (very) dirty (but they just work) : there could be a better way to do this.

@danoli3
Copy link

danoli3 commented Aug 1, 2024

Feel free to jump in and update it to the latest, commit any progress if you get stuck but always can look past ES 1 for the moment

@Daandelange
Copy link
Collaborator

OK, I just updated ImGui to v 1.91.0 which seems to introduce some glfw+emscripten fixes, is that what you're looking after ?

@Jonathhhan
Copy link
Author

Jonathhhan commented Aug 4, 2024

I might be a little slow at the moment with programming, because I enjoy the summer, but I will check it soon. Thank you. I will try it in the next days.

@Daandelange
Copy link
Collaborator

No hurries, take your time and enjoy ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants