From 4e069c768d68ecf8c3b3427fed332ba29341f70f Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Fri, 16 Jul 2021 10:03:01 -0400 Subject: [PATCH] Fix regression with non-power-of-two equirectangular images. This regression was introduced in 9788fc6512fe0de950cb10678dc4d4f453ad376e. --- src/js/libpannellum.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/libpannellum.js b/src/js/libpannellum.js index 2d99354..60c54b0 100644 --- a/src/js/libpannellum.js +++ b/src/js/libpannellum.js @@ -483,8 +483,9 @@ function Renderer(container) { } // Set parameters for rendering any size - if (imageType != "cubemap" && image.width <= maxWidth && haov == 2 * Math.PI) - gl.texParameteri(glBindType, gl.TEXTURE_WRAP_S, gl.REPEAT); + if (imageType != "cubemap" && image.width <= maxWidth && + haov == 2 * Math.PI && (image.width & (image.width - 1)) == 0) + gl.texParameteri(glBindType, gl.TEXTURE_WRAP_S, gl.REPEAT); // Only supported for power-of-two images in WebGL 1 else gl.texParameteri(glBindType, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(glBindType, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);