0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / samples / webgl / ReadMe.md
CommitLineData
565baee6 1OCCT WebGL Viewer sample {#occt_samples_webgl}
2==================
3
4This sample demonstrates simple way of using OCCT libraries in Web application written in C++ and translated into WebAssembly module using Emscripten SDK (emsdk):
5https://emscripten.org/
6
7Sample consists of the Open CASCADE 3D Viewer with a button for opening a model in BREP format.
8The sample requires a WebGL 2.0 capable browser supporting WebAssembly 1.0 (Wasm).
9
10Installation and configuration:
11 1. Install Emscripten SDK and activate minimal configuration (Python, Java and CLang) following *emsdk* documentation. Activate also MinGW when building sample on Windows host.
12 2. Build (using *emsdk*) or download FreeType static library.
13 3. Configure CMake for building Open CASCADE Technology (OCCT) static libraries (BUILD_LIBRARY_TYPE="Static").
14 For this, activate *emsdk* command prompt, configure CMake for building OCCT using cross-compilation toolchain, disable *BUILD_MODULE_Draw*.
15 4. Perform building and installation steps.
16~~~~~
17 > ${EMSDK}/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake
18~~~~~
19 5. Configure CMake for building this WebGL sample using *emsdk* with paths to OCCT and FreeType. Perform building and installation steps.
20 6. Copy data/occ/Ball.brep from OCCT into "samples" folder within WebGL sample installation path.
21 7. Navigate to installation folder and start web server from it; Python coming with *emsdk* can be used for this purpose:
22~~~~~
23 > python -m SimpleHTTPServer 8080
24~~~~~
25 8. Open compatible browser and enter path taking into account your web server settings:
26~~~~~
27 > http://localhost:8080/occt-webgl-sample.html
28~~~~~