Skip to content

Commit

Permalink
Fix canvas.toDataURL yielding blank image.
Browse files Browse the repository at this point in the history
Added `preserveDrawingBuffer` as option to getContext for webgl.
Tested in Chrome and IE11
  • Loading branch information
rasmusvhansen authored Jan 6, 2017
1 parent bff737b commit 3c11c24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jsmpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ jsmpeg.prototype.initWebGL = function() {

// attempt to get a webgl context
try {
gl = this.gl = this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl');
var options = { preserveDrawingBuffer: true };
gl = this.gl = this.canvas.getContext('webgl', options) || this.canvas.getContext('experimental-webgl', options);
} catch (e) {
return false;
}
Expand Down

0 comments on commit 3c11c24

Please sign in to comment.