From 9ba018fe4da328fb8b018682e6340fc9d85e480e Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Tue, 8 Mar 2011 23:23:29 -0500 Subject: [PATCH 1/2] Improve minification of global Math. --- webgl-2d.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webgl-2d.js b/webgl-2d.js index e922821..48122b8 100644 --- a/webgl-2d.js +++ b/webgl-2d.js @@ -42,7 +42,7 @@ * */ -(function(undefined) { +(function(Math, undefined) { // Vector & Matrix libraries from CubicVR.js var M_PI = 3.1415926535897932384626433832795028841968; @@ -757,4 +757,4 @@ }; }; -}()); +}(Math)); From e09ef5099cbbd3f0e32b8555c398001c5d6c6e24 Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Tue, 8 Mar 2011 23:54:15 -0500 Subject: [PATCH 2/2] Deal with canvas width=height=0 and webgl failure. --- webgl-2d.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webgl-2d.js b/webgl-2d.js index 48122b8..5f13c40 100644 --- a/webgl-2d.js +++ b/webgl-2d.js @@ -245,7 +245,8 @@ // Override getContext function with "webgl-2d" enabled version canvas.getContext = (function(gl2d) { return function(context) { - if (gl2d.options.force || context === "webgl-2d") { + if (gl2d.options.force || context === "webgl-2d" && + !(canvas.width === 0 || canvas.height ===0) ) { if (gl2d.gl) { return gl2d.gl; }; var gl = gl2d.gl = gl2d.canvas.$getContext("experimental-webgl");