Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

danilw/nanogui-GLES-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is archived, and not supported! If you look for updates look on other forks example github.com/AE1020 or make your own repository with all updates you need.

nanogui GLES wasm

what is it this is fork of nanogui modified for WASM and GLES (nanovg and nanogui source files modified)

live demo link

Building

$ cd ext
$ git clone https://github.com/libigl/eigen.git
$ cd ..
$ em++ -DNANOVG_GLES3_IMPLEMENTATION -DGLFW_INCLUDE_ES3 -DGLFW_INCLUDE_GLEXT -DNANOGUI_LINUX -Iext/nanovg/ ext/nanovg.c --std=c++11 -O3 -lGL -lGLU -lm -lGLEW -s USE_GLFW=3 -s FULL_ES3=1 -s USE_WEBGL2=1 -o nanovg.bc
$ em++ -DNANOVG_GLES3_IMPLEMENTATION -DGLFW_INCLUDE_ES3 -DGLFW_INCLUDE_GLEXT -DNANOGUI_LINUX -Iinclude/ -Iext/nanovg/ -Iext/eigen/ button.cpp checkbox.cpp colorpicker.cpp colorwheel.cpp combobox.cpp common.cpp glcanvas.cpp glutil.cpp graph.cpp imagepanel.cpp imageview.cpp label.cpp layout.cpp messagedialog.cpp popup.cpp popupbutton.cpp progressbar.cpp screen.cpp serializer.cpp slider.cpp stackedwidget.cpp tabheader.cpp tabwidget.cpp textbox.cpp theme.cpp vscrollpanel.cpp widget.cpp window.cpp nanogui_resources.cpp nanovg.bc --std=c++11 -O3 -lGL -lGLU -lm -lGLEW -s USE_GLFW=3 -s FULL_ES3=1 -s USE_WEBGL2=1 -s WASM=1 -o nanogui.bc
$ mkdir build
$ em++ -DNANOVG_GLES3_IMPLEMENTATION -DGLFW_INCLUDE_ES3 -DGLFW_INCLUDE_GLEXT -DNANOGUI_LINUX -Iinclude/ -Iext/nanovg/ -Iext/eigen/ nanogui.bc example1.cpp --std=c++11 -O3 -lGL -lGLU -lm -lGLEW -s USE_GLFW=3 -s FULL_ES3=1 -s USE_WEBGL2=1 -s WASM=1 -o build/nanogui.html --preload-file ./icons

Problems

  • WARNING I found problem with lambda in WASM, I think it work same way like in Java, in Java "local variables referenced from a lambda expression must be final or effectively final", I mean using any setCallback method you need make all variables Global (include object that call setCallback) or you can not call "callback" from other classes/functions (outside of creation function)
  • std::thread (pthread) support in wasm disabled check this
  • asserts in wasm does not fit C asserts
  • glGetError() has too much errors, better skip checking
  • exceptions to build with -s DISABLE_EXCEPTION_CATCHING=0

pthread nanogui can be builded in wasm with pthreads -s USE_PTHREADS=2 -s PTHREAD_POOL_SIZE=10 need to remove while(true) loop from threads (common.cpp line 79) building with pthread give you (much)less FPS and 100% processor usage, to launch it you need use old browser like firefox 57

About

nanogui port for GLES and WASM

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published