The first step in integrating Emscripten is to choose the backend. See the report below.
Emscripten Integration Report
Good News
- ⭐⭐ Successfully built and tested
demo/sdl3_renderer. Everything works, including builds withINCLUDE_ALL. However, this requires either merging the small PR #883 or manually fixing it by adjusting field types. - ⭐ Successfully built and tested
demo/sdl_opengles2. Everything works as expected. Untested withINCLUDE_ALL. - ❌Successfully built
demo/sdl_renderer. Launch is currently unsuccessful, since openingindex.htmlresults in an infinite loading loop. But I didn't take many attempts.
Bad News
- Standard examples (
Nuklear/example/) based onGLEW/GLFWdo not build due toglMapBufferandglUnmapBuffercalls. 1.1 The issue is described here issues/319. 1.2 There is an interesting PR #873 that introduces ahave_mapbufferflag, but it is alwaystrue. As a temporary workaround, its value could be set based on the__EMSCRIPTEN__macro. 1.3 This PR will only fix demos includingdemo/glfw_opengl3, but the our examples (based onGLFW/OpenGL3too) remain unchanged. - If we choose
sdl3_rendereras the Emscripten backend, we cannot include demo/common/file_browser.c, since theicon_loaduses direct OpenGL calls. This is already fixed in #590.
Notes
- Some work on Emscripten support has already been done by @DeXP:
1.1. In the old repository, this PR addedsdl_opengles2and awebrule toMakefile. 1.2. About 10 years ago, a live version was created, but it is no longer maintained. - I believe, for
sdl3_renderer, it may also make sense to add awebrule in theMakefileto improve consistency.
Activity
7Thanks for the overall push on this one.
Bad News: 1. Standard examples (Nuklear/example/) based on GLEW/GLFW do not build due to glMapBuffer and glUnmapBuffer calls.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
Bad News: 2. If we choose sdl3_renderer as the Emscripten backend, we cannot include demo/common/file_browser.c, since the icon_load uses direct OpenGL calls. This is already fixed in https://github.com/Immediate-Mode-UI/Nuklear/pull/590.
IIRC, there are more problems in demo/sdl3_renderer that may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...)
We can do a little bit of hacky-wacky approach, and still use unchanged demo/sdl3_renderer code by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with *_CREATE_NAME_STRING set to opengles2). If you're interested, let me know, and I'll give you some snippet.
Notes: 2. I believe, for sdl3_renderer, it may also make sense to add a web rule in the Makefile to improve consistency.
According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 implementation port, so in theory you should be able to do emmake make and the spoofed pkg-config should be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)
I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, more?) so I need to do something about them first.
also adding few refs:
Thanks for the overall push on this one.
Bad News: 1. Standard examples (Nuklear/example/) based on GLEW/GLFW do not build due to glMapBuffer and glUnmapBuffer calls.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
Bad News: 2. If we choose sdl3_renderer as the Emscripten backend, we cannot include demo/common/file_browser.c, since the icon_load uses direct OpenGL calls. This is already fixed in https://github.com/Immediate-Mode-UI/Nuklear/pull/590.
IIRC, there are more problems in demo/sdl3_renderer that may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...) EDIT: I think, that demo doesn't need custom image handling, because it has no shaders involved and simply passthroughs the texture handle, but I'm not sure, if it works correctly, as I never tested it.
We can do a little bit of hacky-wacky approach, and still use unchanged demo/sdl3_renderer code by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with *_CREATE_NAME_STRING set to opengles2). If you're interested, let me know, and I'll give you some snippet.
Notes: 2. I believe, for sdl3_renderer, it may also make sense to add a web rule in the Makefile to improve consistency.
According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 implementation port, so in theory you should be able to do emmake make and the spoofed pkg-config should be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)
I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, more?) so I need to do something about them first.
also adding few refs:
Thanks for the overall push on this one.
Bad News: 1. Standard examples (Nuklear/example/) based on GLEW/GLFW do not build due to glMapBuffer and glUnmapBuffer calls.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
Bad News: 2. If we choose sdl3_renderer as the Emscripten backend, we cannot include demo/common/file_browser.c, since the icon_load uses direct OpenGL calls. This is already fixed in https://github.com/Immediate-Mode-UI/Nuklear/pull/590.
IIRC, there are more problems in demo/sdl3_renderer that may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...) EDIT: I think, that demo doesn't need custom image handling, because it has no shaders involved and simply passthroughs the texture handle, but I'm not sure, if it works correctly, as I never tested it.
We can do a little bit of hacky-wacky approach, and still use unchanged demo/sdl3_renderer code by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with *_CREATE_NAME_STRING set to opengles2). If you're interested, let me know, and I'll give you some snippet.
Notes: 2. I believe, for sdl3_renderer, it may also make sense to add a web rule in the Makefile to improve consistency.
According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 port, so in theory you should be able to do EDIT: added PR for this one: https://github.com/Immediate-Mode-UI/Nuklear/pull/894emmake make and the spoofed pkg-config should be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)
I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, https://github.com/Immediate-Mode-UI/Nuklear/pull/894, more?) so I need to do something about them first.
also adding few refs:
(I'm well aware the text above is LLM-generated)
Thanks for the overall push on this one.
Bad News: 1. Standard examples (Nuklear/example/) based on GLEW/GLFW do not build due to glMapBuffer and glUnmapBuffer calls.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
Bad News: 2. If we choose sdl3_renderer as the Emscripten backend, we cannot include demo/common/file_browser.c, since the icon_load uses direct OpenGL calls. This is already fixed in https://github.com/Immediate-Mode-UI/Nuklear/pull/590.
IIRC, there are more problems in demo/sdl3_renderer that may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...) EDIT: I think, that demo doesn't need custom image handling, because it has no shaders involved and simply passthroughs the texture handle, but I'm not sure, if it works correctly, as I never tested it.
We can do a little bit of hacky-wacky approach, and still use unchanged demo/sdl3_renderer code by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with *_CREATE_NAME_STRING set to opengles2). If you're interested, let me know, and I'll give you some snippet.
Notes: 2. I believe, for sdl3_renderer, it may also make sense to add a web rule in the Makefile to improve consistency.
According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 port, so in theory you should be able to do EDIT: added PR for this one: https://github.com/Immediate-Mode-UI/Nuklear/pull/894emmake make and the spoofed pkg-config should be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)
I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, https://github.com/Immediate-Mode-UI/Nuklear/pull/894, more?) so I need to do something about them first.
also adding few refs:
(I'm well aware the text above is LLM-generated/edited)
Bad News: 1. Standard examples (Nuklear/example/) based on GLEW/GLFW do not build due to glMapBuffer and glUnmapBuffer calls.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
Bad News: 2. If we choose sdl3_renderer as the Emscripten backend, we cannot include demo/common/file_browser.c, since the icon_load uses direct OpenGL calls. This is already fixed in https://github.com/Immediate-Mode-UI/Nuklear/pull/590.
IIRC, there are more problems in demo/sdl3_renderer that may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...) EDIT: I think, that demo doesn't need custom image handling, because it has no shaders involved and simply passthroughs the texture handle, but I'm not sure, if it works correctly, as I never tested it.
We can do a little bit of hacky-wacky approach, and still use unchanged demo/sdl3_renderer code by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with *_CREATE_NAME_STRING set to opengles2). If you're interested, let me know, and I'll give you some snippet.
Notes: 2. I believe, for sdl3_renderer, it may also make sense to add a web rule in the Makefile to improve consistency.
According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 port, so in theory you should be able to do EDIT: added PR for this one: https://github.com/Immediate-Mode-UI/Nuklear/pull/894emmake make and the spoofed pkg-config should be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)
I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, https://github.com/Immediate-Mode-UI/Nuklear/pull/894, more?) so I need to do something about them first.
also adding few refs:
(I'm well aware the text above is LLM-generated/edited)
Bad News: 1. Standard examples (Nuklear/example/) based on GLEW/GLFW do not build due to glMapBuffer and glUnmapBuffer calls.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
Bad News: 2. If we choose sdl3_renderer as the Emscripten backend, we cannot include demo/common/file_browser.c, since the icon_load uses direct OpenGL calls. This is already fixed in https://github.com/Immediate-Mode-UI/Nuklear/pull/590.
IIRC, there are more problems in demo/sdl3_renderer that may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...) EDIT: I think, that demo doesn't need custom image handling, because it has no shaders involved and simply passthroughs the texture handle, but I'm not sure, if it works correctly. I never tested it.
We can do a little bit of hacky-wacky approach, and still use unchanged demo/sdl3_renderer code by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with *_CREATE_NAME_STRING set to opengles2). If you're interested, let me know, and I'll give you some snippet.
Notes: 2. I believe, for sdl3_renderer, it may also make sense to add a web rule in the Makefile to improve consistency.
According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 port, so in theory you should be able to do EDIT: added PR for this one: https://github.com/Immediate-Mode-UI/Nuklear/pull/894emmake make and the spoofed pkg-config should be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)
I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, https://github.com/Immediate-Mode-UI/Nuklear/pull/894, more?) so I need to do something about them first.
also adding few refs:
Thanks for the overall push on this one.
(disclaimer: I'm the "author" of this demo, so my take is biased) If this is not obvious for someone, the are several reasons why want to reuse demo/sdl3_renderer for live web demo: SDL3 is the most portable target with the biggest possible feature set; it was tested by several contributors and we fixed few bugs for it; main.c has huge config that makes it easy to compile; I keep patching and supporting it; Emscripten upstream itself is supporting SDL. Of course the best one would be SDL3+GLES2 or SDL3+WebGL but we don't have anything like this at the moment.
Yes, this is a huge problem that we will need to solve somehow. For now, I think it would be fine to simply exclude some of those examples, and rewrite them later.
IIRC, there are more problems in
demo/sdl3_rendererthat may prevent you from loading images. I believe, I just forgot to implement this functionality back in https://github.com/Immediate-Mode-UI/Nuklear/pull/852 and only recently noticed (shame on me...)We can do a little bit of hacky-wacky approach, and still use unchanged
demo/sdl3_renderercode by creating SDL_Renderer backed by GLES2 context (aka SDL_CreateRendererWithProperties with*_CREATE_NAME_STRINGset toopengles2). If you're interested, let me know, and I'll give you some snippet.According to https://github.com/emscripten-core/emscripten/issues/23831 the most up to date version of Emscripten should already ship with it's own SDL3 implementation, so in theory you should be able to do
emmake makeand the spoofedpkg-configshould be able to pick that version. If that's not happening, then maybe there is something wrong with that makefile (?)I'm planning to do some work on this demo, so I will most likely fix those issues too. If you (or anyone reading this) have any wishlist about some other features/fixes, let me know ;) Currently, there are several PRs open touching this code (https://github.com/Immediate-Mode-UI/Nuklear/pull/884, https://github.com/Immediate-Mode-UI/Nuklear/pull/878, https://github.com/Immediate-Mode-UI/Nuklear/pull/879, https://github.com/Immediate-Mode-UI/Nuklear/pull/841, more?) so I need to do something about them first.
also adding few refs: