And I wonder if it’s also possible to compile OF to webAssembly.
I learned from this website http://webassembly.org/docs/c-and-c++/ that webAssembly can use C/C++ APIs such as the C and C++ standard libraries, OpenGL, SDL, pthreads, and others, just as in normal C/C++ development .
Thanks a lot in advance.
webAssembly is build on the specification of asm.js. Emscripten is a compiler, and it can compile to asm.js or webAssembly.
This article http://webassembly.org/getting-started/developers-guide/ explain how to use emscripten to create a web assembly module.
-s WASM=1 flag
“An open source community project supported by Mozilla, Emscripten is a GCC/Clang-compatible compiler toolchain that allows building WebAssembly applications on the web. The main scope of Emscripten is support for the C/C++ language family, but because Emscripten is powered by LLVM, it has potential to allow other languages to compile as well. If your game is developed in C/C++ and it targets OpenGL ES 2 or 3, an Emscripten-based port to the web can be a viable approach.”
What you can do now is to write a module in C++, c, rust or whatever, compile it (using Emscripten), and include it in your web application.
If you are interested in webAssembly, I suggest you to read this article serie, it is absolutely great:
Hi @edapx Thank you so much for your answer! It was really helpful.
Hey @cuinjune, I’ve just read this issue
It looks like you’ve already found how to get there! did you find a way to compile it to WASM? I’m having some problems too.
Nope… I couldn’t even compile to normal emscripten as explained here. http://openframeworks.cc/setup/emscripten/
It’s weird because I remember I ran the example successfully when I first tried out with the earlier version of OF 0.9 but now it doesn’t work.
Or it could be the OS, or the browser’s problem. I don’t know…
I use OF 0.9.8 on Mac OS X 10.11.6.