a minimal example of C# wasm WebGL app based on dotnet/runtimelab/NativeAOT-LLVM WebAssembly
This example is ported from emscripten\tests\minimal_webgl.
https://zwcloud.github.io/MinimalCSharpWasmWebGL-NativeAOT-LLVM/
dotnet publish -r browser-wasm -c Debug /p:TargetArchitecture=wasm --self-contained /p:PlatformTarget=AnyCPU /p:MSBuildEnableWorkloadResolver=false /p:EmccExtraArgs='WebGL.c main.c --js-library library_js.js -s USE_WEBGL2=1 -lGL'
Note WebGL.c
and main.c
is passed as a EmccExtraArgs
parameter to emcc
.
In browser:
Host a web-site under .\bin\Debug\net6.0\browser-wasm\native\
. Open the html page, for example http:\127.0.0.1:81\wasm.html, in the browser.