Added proper error message if WebGL not supported

This commit is contained in:
Joost Nieuwenhuijse 2012-01-21 15:24:03 +01:00
parent a5ee34852b
commit a66db774a2

View file

@ -4,13 +4,9 @@ OpenJsCad = function() {
// A viewer is a WebGL canvas that lets the user view a mesh. The user can
// tumble it around by dragging the mouse.
OpenJsCad.Viewer = function(containerelement, width, height, initialdepth) {
try
{
var gl = GL.create();
if(!gl)
{
containerelement.innerHTML = "WebGL is required for the 3D viewer, but your browser doesn't seem to support this.";
}
else
{
this.gl = gl;
this.angleX = 0;
this.angleY = 0;
@ -86,6 +82,9 @@ OpenJsCad.Viewer = function(containerelement, width, height, initialdepth) {
};
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 = {