
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
ThoughtStuff.WebGLTemplate
Advanced tools
A project template for creating WebGL-based WASM browser apps in C#.
dotnet new webgl
This template includes a very basic GameFramework
to help you get started.
You only need to implement IGame
and pass your Game instance to the GameController
in Program.cs
.
See ExampleGame.cs
for a simple example.
See the Examples folder for more examples.
That said, you are not required to use the GameFramework
. You can delete the GameFramework
folder and implement your own rendering and update logic.
The IGame
interface provides some "lifecycle" methods for you to implement for initialization, input, updates and rendering.
These methods are called by the GameController
at the appropriate times.
See IGame.cs for documentation.
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:
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.
FAQs
A project template for creating WebGL-based WASM browser apps in C#.
We found that thoughtstuff.webgltemplate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.