OpenSceneGraph/examples/osgemscripten
2017-06-22 09:44:06 +07:00
..
box.osgt Add osgemscripten example 2017-06-22 09:44:06 +07:00
CMakeLists.txt Add osgemscripten example 2017-06-22 09:44:06 +07:00
functions.h Add osgemscripten example 2017-06-22 09:44:06 +07:00
osgemscripten.cpp Add osgemscripten example 2017-06-22 09:44:06 +07:00
osgemscripten.h Add osgemscripten example 2017-06-22 09:44:06 +07:00
README.md Add osgemscripten example 2017-06-22 09:44:06 +07:00

How to build osgemscripten example

1. Install Emscripten

Download and install Emscripten portable SDK

2. Create build directory

Run the following commands:

mkdir /path/to/build/dir

cd /path/to/build/dir

3. Configure example

Run the following command:

cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/emsdk-portable/emscripten/<version>/cmake/Modules/Platform/Emscripten.cmake /path/to/OpenSceneGraph/examples/osgemscripten

This also configures OpenSceneGraph as a dependency

3. Build example

Run the following command:

make

This also builds OpenSceneGraph under /path/to/OpenSceneGraph/build/Emscripten if it has not yet been built.

4. Launch example

Firefox only: locate and open osgemscripten.html file.

All browsers:

  • go to the directory with osgemscripten.html
  • run python -m SimpleHTTPServer 8080 from there
  • open http://localhost:8080/osgemscripten.html in any browser

You should now see red cube in your web browser.