Skip to content

Emscripten 5#8510

Merged
danoli3 merged 5 commits intoopenframeworks:masterfrom
danoli3:emscripten_5
Apr 24, 2026
Merged

Emscripten 5#8510
danoli3 merged 5 commits intoopenframeworks:masterfrom
danoli3:emscripten_5

Conversation

@danoli3
Copy link
Copy Markdown
Member

@danoli3 danoli3 commented Apr 6, 2026

Emscripten 5

  • Updates Emscripten 4.0.4 -> Emscripten 5.0.5
  • added cmakelist.txt for testing
  • fixed makefile for webgpu (not used in our code)

Problems

  • Emscripten ES2 spec is using ES3 with some issues around face winding and meshes. This was noted in 4.0.4 however with more testing this is now more of a problem - Solution support ES3 properly and merge ES3 support via android PR and make amendments.

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 6, 2026

Problems:

3D Face Winding issues.

Screenshot 2026-04-05 at 1 48 40 pm Also occurring on Font Faces Screenshot 2026-04-05 at 12 51 22 pm

Isolated issue to:
PLATFORM_LDFLAGS += -s MAX_WEBGL_VERSION=2 -s WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION=1 -s FULL_ES2

So where WebGL version == 2. ES3 is supported so we are missing critical ES3 commands for Faces

With WebGL == 1
PLATFORM_LDFLAGS += -s MAX_WEBGL_VERSION=1 -s MIN_WEBGL_VERSION=1 -s FULL_ES2=1

Now exposes the missing ES3 commands being used in engine without guards.

error: undefined symbol: glBeginTransformFeedback (referenced by root reference (e.g. compiled C/C++ code))
warning: To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _glBeginTransformFeedback may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library

error: undefined symbol: glBindBufferBase (referenced by root reference (e.g. compiled C/C++ code))
warning: _glBindBufferBase may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
adding glBindBufferBase (referenced by root reference (e.g. compiled C/C++ code))


rror: undefined symbol: glBindBufferRange (referenced by root reference (e.g. compiled C/C++ code))
warning: _glBindBufferRange may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
adding glBindBufferRange (referenced by root reference (e.g. compiled C/C++ code))


error: undefined symbol: glEndTransformFeedback (referenced by root reference (e.g. compiled C/C++ code))
warning: _glEndTransformFeedback may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
adding glEndTransformFeedback (referenced by root reference (e.g. compiled C/C++ code))

Proper solution merge and support ES3 and use DEFINES for ES3 support
danoli3#4

I'll look at patching this in now 10 years later XD

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 7, 2026

Yeah looking more into the ES3 support and looking at the TARGET_EMSCRIPTEN defines I can see how this was broken for meshes.

Shall apply fix.

Also https://www.pongasoft.com/blog/yan/webassembly/2024/09/12/Introducing-emscripten-glfw
We should apply the emscripten glfw with multi window support for the windowing system

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 7, 2026

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 7, 2026

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 8, 2026

image

fonts are now rendering with latest ES3 changes. Meshes are still broken

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 8, 2026

image

emscripten-glfw added works very fast now

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 8, 2026

Okay figured it out was something to do with ofGetGLPrimitiveMode(vertexData.getMode()) returning quads or something and needs GL_TRIANGLE
image

forced triangles now the back boxes on gui broken, step towards complete!

glfw emscripten so fast btw

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 8, 2026

Turned out to be mesh primitive type being set on mesh to LINES
image

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 8, 2026

Fonts still not rendering on Emscripten in true type

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 8, 2026

https://openframeworks.danoli3.com/easyCamExample/

image

okay this is looking great

danoli3 added 3 commits April 24, 2026 14:46
- emmake.sh in template
- CMakeList.txt for emscripten

(cherry picked from commit 0bad750)
@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 24, 2026

Thanks @Scylardor for the Testator fix

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 24, 2026

Okay tested on a few projects. assimpModelLoader, easyCam and imgui projects. This is ready.

Embind AOT now be controlled via define
TOTAL memory to initial as per spec
@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 24, 2026

@danoli3
Copy link
Copy Markdown
Member Author

danoli3 commented Apr 24, 2026

Merging once ci is complete @ofTheo

@danoli3 danoli3 added this to the 0.12.2 milestone Apr 24, 2026
@danoli3 danoli3 added the webgl label Apr 24, 2026
@danoli3 danoli3 merged commit 619c7d5 into openframeworks:master Apr 24, 2026
20 checks passed
@danoli3 danoli3 deleted the emscripten_5 branch April 24, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant