diff --git a/src/Renderer/c3DEngine.js b/src/Renderer/c3DEngine.js index 80b95b8c3f..d83f69a4ed 100644 --- a/src/Renderer/c3DEngine.js +++ b/src/Renderer/c3DEngine.js @@ -222,7 +222,7 @@ class c3DEngine { bufferToImage(pixelBuffer, width, height) { var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); + var ctx = canvas.getContext('2d', { willReadFrequently: true }); // size the canvas to your desired image canvas.width = width; diff --git a/src/Utils/DEMUtils.js b/src/Utils/DEMUtils.js index 2881b47c89..d4ad018c7a 100644 --- a/src/Utils/DEMUtils.js +++ b/src/Utils/DEMUtils.js @@ -147,7 +147,7 @@ function _readTextureValueAt(metadata, texture, ...uv) { _canvas.width = Math.max(_canvas.width, dw); _canvas.height = Math.max(_canvas.height, dh); - const ctx = _canvas.getContext('2d'); + const ctx = _canvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(texture.image, minx, miny, dw, dh, 0, 0, dw, dh); const d = ctx.getImageData(0, 0, dw, dh);