I am not able to upload my Babylon file on itch.io server. The playground works perfectly fine but when I upload it on itch.io, I get these errors:
the available createEngine function failed. Creating the default engine instead
babylon.js:16 Uncaught (in promise) Error: WebGL not supported
at t.e (babylon.js:16)
at new t (babylon.js:16)
at createDefaultEngine (index.html:48)
at asyncEngineCreation (index.html:1036)
at initFunction (index.html:1040)
at index.html:1043
I feel I must change something here in my code:
...
...
var engine;
var scene;
initFunction = async function() {
var asyncEngineCreation = async function() {
try {
return createDefaultEngine();
} catch(e) {
console.log("the available createEngine function failed. Creating the default engine instead");
return createDefaultEngine();
}
}
engine = await asyncEngineCreation();
if (!engine) throw 'engine should not be null.';
scene = createScene();};
initFunction().then(() => {sceneToRender = scene
engine.runRenderLoop(function () {
if (sceneToRender && sceneToRender.activeCamera) {
sceneToRender.render();
}
});
});
// Resize
window.addEventListener("resize", function () {
engine.resize();
});
</script>
</body>
</html>
Can someone help me here?