Added proper error message if WebGL not supported
This commit is contained in:
parent
a5ee34852b
commit
a66db774a2
13
openjscad.js
13
openjscad.js
|
@ -4,13 +4,9 @@ OpenJsCad = function() {
|
||||||
// A viewer is a WebGL canvas that lets the user view a mesh. The user can
|
// A viewer is a WebGL canvas that lets the user view a mesh. The user can
|
||||||
// tumble it around by dragging the mouse.
|
// tumble it around by dragging the mouse.
|
||||||
OpenJsCad.Viewer = function(containerelement, width, height, initialdepth) {
|
OpenJsCad.Viewer = function(containerelement, width, height, initialdepth) {
|
||||||
var gl = GL.create();
|
try
|
||||||
if(!gl)
|
|
||||||
{
|
{
|
||||||
containerelement.innerHTML = "WebGL is required for the 3D viewer, but your browser doesn't seem to support this.";
|
var gl = GL.create();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.gl = gl;
|
this.gl = gl;
|
||||||
this.angleX = 0;
|
this.angleX = 0;
|
||||||
this.angleY = 0;
|
this.angleY = 0;
|
||||||
|
@ -85,7 +81,10 @@ OpenJsCad.Viewer = function(containerelement, width, height, initialdepth) {
|
||||||
_this.onDraw();
|
_this.onDraw();
|
||||||
};
|
};
|
||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
containerelement.innerHTML = "<b><br><br>Error: "+e.toString()+"</b><br><br>OpenJsCad currently requires Google Chrome with WebGL enabled";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OpenJsCad.Viewer.prototype = {
|
OpenJsCad.Viewer.prototype = {
|
||||||
|
|
Loading…
Reference in a new issue