Added texture related functions to gl_functions.js

This commit is contained in:
2025-09-01 20:46:25 -07:00
parent 81f5457b61
commit 7c61189d3a
5 changed files with 259 additions and 38 deletions

View File

@@ -23,14 +23,6 @@ function AcquireCanvas(canvasWidth, canvasHeight)
appGlobals.canvas = canvas;
}
function CreateGlContext()
{
var canvasContextGl = appGlobals.canvas.getContext("webgl2");
if (canvasContextGl === null) { console.error("Unable to initialize WebGL render context. Your browser or machine may not support it :("); return null; }
// console.dir(canvasContextGl);
appGlobals.glContext = canvasContextGl;
}
async function LoadWasmModule(wasmFilePath, initialWasmPageCount)
{
appGlobals.textDecoder = new TextDecoder("utf-8");
@@ -50,7 +42,11 @@ async function MainLoop()
{
console.log("Initializing WebGL Canvas...");
AcquireCanvas(600, 400);
CreateGlContext();
var canvasContextGl = appGlobals.canvas.getContext("webgl2");
if (canvasContextGl === null) { console.error("Unable to initialize WebGL render context. Your browser or machine may not support it :("); return; }
// console.dir(canvasContextGl);
appGlobals.glContext = canvasContextGl;
console.log("Loading WASM Module...");
await LoadWasmModule("app.wasm", 4);