From e6162f5c8acea642fd0884a6b8db367b911e5461 Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 6 Sep 2023 23:55:57 -0400 Subject: set preserveDrawingBuffer context attribute --- pugl.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pugl.js') diff --git a/pugl.js b/pugl.js index 7708b31..aea16fd 100644 --- a/pugl.js +++ b/pugl.js @@ -2822,10 +2822,16 @@ function startup() { if (!has_error()) export_widgets_to_local_storage(); }); - gl = canvas.getContext('webgl2'); + const context_attributes = { + // without this, "save image as..." is broken on firefox + // see https://bugzilla.mozilla.org/show_bug.cgi?id=749824 + preserveDrawingBuffer: true, + }; + + gl = canvas.getContext('webgl2', context_attributes); if (gl === null) { // support for very-old-but-not-ancient browsers - gl = canvas.getContext('experimental-webgl2'); + gl = canvas.getContext('experimental-webgl2', context_attributes); if (gl === null) { show_error('your browser doesnt support webgl2.\noh well.'); return; -- cgit v1.2.3