Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
[META::Emscripten] Live version integration strategy and progress report
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
### The first step in integrating Emscripten is to choose the backend. See the report below.
Emscripten Integration Report
-----------------------------------------
### Good News
1. ⭐⭐ Successfully built and tested `demo/sdl3_renderer`.
Everything works, including builds with `INCLUDE_ALL`. However, this requires either merging the small PR #883 or manually fixing it by adjusting field types.
2. ⭐ Successfully built and tested `demo/sdl_opengles2`.
Everything works as expected. Untested with `INCLUDE_ALL`.
3. ❌Successfully built `demo/sdl_renderer`.
Launch is currently unsuccessful, since opening `index.html` results in an infinite loading loop. But I didn't take many attempts.
### Bad News
1. Standard examples (`Nuklear/example/`) based on `GLEW/GLFW` do not build due to `glMapBuffer` and `glUnmapBuffer` calls.
1.1 The issue is described here [issues/319](https://github.com/vurtun/nuklear/issues/319).
1.2 There is an interesting PR #873 that introduces a `have_mapbuffer` flag, but it is always `true`. As a temporary workaround, its value could be set based on the `__EMSCRIPTEN__` macro.
1.3 This PR will **only fix demos** including `demo/glfw_opengl3`, but the our [examples](https://github.com/Immediate-Mode-UI/Nuklear/tree/master/example) (based on `GLFW/OpenGL3` too) **remain unchanged**.
2. If we choose `sdl3_renderer` as the Emscripten backend, we cannot include [demo/common/file_browser.c](https://github.com/Immediate-Mode-UI/Nuklear/blob/master/demo/common/file_browser.c), since the `icon_load` uses direct OpenGL calls. This is already fixed in #590.
### Notes
1. Some work on Emscripten support has already been done by @DeXP:\
1.1. In the old repository, [this PR](https://github.com/vurtun/nuklear/pull/534) added `sdl_opengles2` and a `web` rule to `Makefile`.
1.2. About 10 years ago, a [live version](https://github.com/DeXP/nuklear-webdemo) was created, but it is no longer maintained.
2. I believe, for `sdl3_renderer`, it may also make sense to add a `web` rule in the `Makefile` to improve consistency.
Contributor guide
Research direction
Start with the Emscripten integration report, the referenced demo/sdl3_renderer, demo/sdl_opengles2, demo/sdl_renderer, demo/common/file_browser.c, and the Makefile web rule. Review PRs #883, #873, and #590 plus issue #319 to understand the reported build and loading problems. Done requires a decided backend and a documented integration plan or implementation path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100