屏蔽不支持WebGL的浏览器

pull/441/head
ChenX 5 years ago
parent 60390b57d9
commit 864f38ab98

@ -32,6 +32,24 @@ document.ondragover = e => e.preventDefault();
window.onload = function () window.onload = function ()
{ {
function isWebGLAvailable()
{
try
{
var canvas = document.createElement('canvas');
return !!(globalThis.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')));
}
catch (e)
{
return false;
}
}
if (!isWebGLAvailable())
{
document.body.textContent = "您的浏览器不支持WebGL!";
return;
}
Object3D.DefaultMatrixAutoUpdate = false; Object3D.DefaultMatrixAutoUpdate = false;
Vector2.prototype.asVector3 = function () Vector2.prototype.asVector3 = function ()
{ {

Loading…
Cancel
Save