ThoughtStuff.WebGLTemplate
1.4.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet new install ThoughtStuff.WebGLTemplate::1.4.0
This package contains a .NET Template Package you can call from the shell/command line.
.NET WebGL Template
dotnet new webgl
This template is a starting point for creating .NET projects that target WebAssembly and leverage WebGL.
Check out ExampleGame.cs
to get started.
Invoking WebGL functions is straightforward via the global static GL
class.
GL.ClearColor(0.39f, 0.58f, 0.93f, 1.0f);
GL.Clear(GL.COLOR_BUFFER_BIT);
The GL context is effectively exported by JS as follows:
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
setModuleImports("main.js", { gl });
And imported in C# as in this example:
public static partial class GL
{
[JSImport("gl.clearColor", "main.js")]
internal static partial void ClearColor(float red, float green, float blue, float alpha);
}
So this approach is limited to one Canvas context.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.