A simple WebGL application compiled to WebAssembly using Emscripten.
Install Emscripten SDK (emsdk)
For detailed installation instructions, visit: https://emscripten.org/docs/getting_started/downloads.html
- Create a build directory and navigate to it:
mkdir build
cd build
- Configure with CMake:
emcmake cmake .. -DCMAKE_BUILD_TYPE=Debug
- Build the project:
cmake --build .
After building, you can run the application using:
emrun app-demo.html
Or serve the files using any web server. The following files are needed:
- app-demo.html
- app-demo.js
- app-demo.wasm
src/main_webgl.cpp
- Main application code with WebGL setup and renderingsrc/main_webgpu.cpp
- Main application code with WebGPU setup and renderingsrc/app-demo.html
- HTML template for the applicationCMakeLists.txt
- CMake build configuration
This demo creates a WebGL context and renders a simple red triangle using WebAssembly. It demonstrates:
- WebGL context creation with Emscripten
- Basic shader setup
- Vertex buffer creation and rendering
- Main loop implementation for web