glvis v0.6.3
GLVis JavaScript Library
Using Emscripten GLVis can be built as a JavaScript & WebAssembly library.
A fully-featured web version of GLVis is available at https://glvis.org/live with documentation in live/README.md.
Using a pre-built version of the glvis.js library
A pre-built JavaScript library is included at src/glvis.js, but because of its size it is stored using Git's Large File Storage, git-lfs.
To use the pre-built library, e.g. with the examples in the examples/ directory, or with the web version
in the live/ directory, you need first to enable git-lfs on your system, see the instructions on the
git-lfs page.
For example, a simple run with the pre-built library can be executed on a Mac from scratch with:
brew install git-lfs
git lfs install
git clone git@github.com:GLVis/glvis-js.git
cd glvis-js/examples
open basic.htmlBuilding glvis.js
Install Emscripten
[git clone https://github.com/emscripten-core/emsdk.git] cd emsdk git pull ./emsdk install latest ./emsdk activate latest source "/path/to/emsdk/emsdk_env.sh"Get copies of glvis and mfem
git clone git@github.com:mfem/mfem.git git clone git@github.com:GLVis/glvis.gitClone included submodules
git clone --recurse-submodules git@github.com:GLVis/glvis-js.gitIf you've already cloned you can pull submodules with:
git submodule update --init --recursiveGet a copy of OpenSans.ttf and put it in the GLVis root directory. For example
cd glvis-js curl -s -o ../glvis/OpenSans.ttf https://raw.githubusercontent.com/google/fonts/master/apache/opensans/OpenSans-Regular.ttfBuild:
make realclean # or just clean if you don't want to rebuild mfem make install -jPatch glvis.js (temporary):
Edit src/glvis.js and add
return 0;to the top of_JSEvents_requestFullscreen(see Known Issues)
NOTE: Emscripten handles SDL2 and GLEW but if you have another installation in your path the link might fail.
Serving to a device on your local network
The serve make target allows you to serve your local glvis-js to other devices on your
network.
For example, on a Mac:
First, get
your IP address:ipconfig getifaddr en0or alternatively your
hostname:hostname -sThen, serve
glvis-jsto all devices in your local network:make serveAny device in your network can now connect to
{your IP address}:8000or{hostname}:8000to use the local version ofglvis-js. On the local host, you can also uselocalhost:8000.
Contributing
Please run make style before pushing your changes. make style uses
prettier and requires that you have
npx in your path. prettier will
be installed for you when running make style if you don't already have it.
Updating glvis.js
Use
make installto build and install a newglvis.jsandversions.jsto src/Please add the output of
make versionsto the commit body.
Releasing
Update the version:
npm version <update_type><update_type>is one ofpatch,minor, ormajor
npm loginnpm publish
More info here.
Known issues and limitations
Opening new examples results in memory growth
Fullscreen events captured by the Emscripten Module are difficult to control
_JSEvents_requestFullscreenin glvis.js takes over the whole screen- For now we patch this to be a noop
- Setting a noop with
emscripten_set_fullscreenchange_callbackdoesn't seem to do it
_emscripten_set_canvas_element_sizeand__set_canvas_element_sizeprint errors and duplicate some existing behavior
Lots of console warnings
TODO
- Multiple output windows
- MFEM stream with multiple fields causes the visualizations to write over each other
- Improve the I/O e.g. corresponding to key
F6 - Improve experience on mobile devices with touch interfaces
- Allow for screenshots/printing with
S/Ctr-P, see https://github.com/GLVis/pyglvis/issues/5 - Provide easier ways to generate
*.savedfiles - Support Binary streams
- Browser differences
- Fullscreen in Safari
- Help menu overflow in Safari and Firefox
- Secure websockets