Skip to content

Commit

Permalink
Deal with canvas width=height=0 and webgl failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Humphrey committed Mar 9, 2011
1 parent 9ba018f commit e09ef50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webgl-2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit e09ef50

Please sign in to comment.