diff --git a/src/renderer/snapshot/WebGLSnapshot.js b/src/renderer/snapshot/WebGLSnapshot.js index d8e6719b4..ee51c702e 100644 --- a/src/renderer/snapshot/WebGLSnapshot.js +++ b/src/renderer/snapshot/WebGLSnapshot.js @@ -17,12 +17,12 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @function Phaser.Renderer.Snapshot.WebGL * @since 3.0.0 * - * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {WebGLRenderingContext} sourceContext - The WebGL context to take a snapshot of. * @param {Phaser.Types.Renderer.Snapshot.SnapshotState} config - The snapshot configuration object. */ -var WebGLSnapshot = function (sourceCanvas, config) +var WebGLSnapshot = function (sourceContext, config) { - var gl = sourceCanvas.getContext('experimental-webgl'); + var gl = sourceContext; var callback = GetFastValue(config, 'callback'); var type = GetFastValue(config, 'type', 'image/png'); diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js index bdfcb04d3..7eaacf58c 100644 --- a/src/renderer/webgl/WebGLRenderer.js +++ b/src/renderer/webgl/WebGLRenderer.js @@ -2654,7 +2654,7 @@ var WebGLRenderer = new Class({ if (state.callback) { - WebGLSnapshot(this.canvas, state); + WebGLSnapshot(this.gl, state); state.callback = null; } @@ -2814,7 +2814,7 @@ var WebGLRenderer = new Class({ this.setFramebuffer(framebuffer); - WebGLSnapshot(this.canvas, state); + WebGLSnapshot(this.gl, state); this.setFramebuffer(currentFramebuffer);