igl icon indicating copy to clipboard operation
igl copied to clipboard

Emscripten WebAssembly triangle sample

Open jwric opened this issue 2 years ago • 9 comments

Some checks for emscripten were added in cmakelists files and added a sample for WebAssembly, ported from the "Tiny" triangle example.

To generate files:

$ mkdir build-em
$ cd build-em
$ cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
$ ninja

image

jwric avatar Jul 09 '23 03:07 jwric

Please apply cmake-format.

corporateshark avatar Jul 09 '23 04:07 corporateshark

Fun fact, I implemented almost identical example. I'll accept this PR and rebase my another example on top of yours.

rudybear avatar Jul 09 '23 05:07 rudybear

@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jul 09 '23 05:07 facebook-github-bot

@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jul 09 '23 20:07 facebook-github-bot

I will address all of your suggested changes, and if the end changes are satisfying I suggest they should also be applied to the Tiny.cpp example, because I basically just copied the file and made a few edits for IGL's WebGL integration to work.

jwric avatar Jul 10 '23 21:07 jwric

@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jul 11 '23 04:07 facebook-github-bot

@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jul 11 '23 04:07 facebook-github-bot

@jwric I refactored CMakeLists a little bit, can you rebase on top of main and add Triangle.cpp into wasm folder?

rudybear avatar Jul 11 '23 04:07 rudybear

@jwric I refactored CMakeLists a little bit, can you rebase on top of main and add Triangle.cpp into wasm folder?

Done, but specifying the shell file as "../samples/wasm/igl.html" doesn't seem to work if you're building in a different folder. I guess it works if you follow the build instructions but still

jwric avatar Jul 11 '23 14:07 jwric

@rudybear has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jul 13 '23 16:07 facebook-github-bot

@rudybear merged this pull request in facebook/igl@bffb08ccbf379c2de5ebd91d878c8607f11cd761.

facebook-github-bot avatar Jul 13 '23 19:07 facebook-github-bot