Fix NS mirror: UNPACK_FLIP_Y_WEBGL was double-flipping

With the flag on, canvas row Y was uploaded to texture row (H-1-Y).
Sampling at V=0.58 then returned canvas row 2688 (in the 'south'
half of the corridor), but the shader expected row 3712 (in the
'north' half) for an offset.z=2 sample. So tiles appeared
mirrored across the NS axis — every N pointed south, every S north.

With the flag off, canvas row Y maps to texture row Y, and the
shader's expectation matches the drawing direction. Now N is at
the image's actual north, S at the image's actual south.
This commit is contained in:
Richard Zink committed 2026-10-08 06:48:10 +02:00
1 parent 6e96c5ffad
commit a05951efbd
1 file changed
+1 -1
+1 -1
View File
@@ -447,7 +447,7 @@ function initGroundSystem(glCtx) {
groundCtx.fillRect(0, 0, groundCanvas.width, groundCanvas.height); groundCtx.fillRect(0, 0, groundCanvas.width, groundCanvas.height);
groundTexture = groundGl.createTexture(); groundTexture = groundGl.createTexture();
groundGl.bindTexture(groundGl.TEXTURE_2D, groundTexture); groundGl.bindTexture(groundGl.TEXTURE_2D, groundTexture);
groundGl.pixelStorei(groundGl.UNPACK_FLIP_Y_WEBGL, true); groundGl.pixelStorei(groundGl.UNPACK_FLIP_Y_WEBGL, false);
groundGl.texImage2D(groundGl.TEXTURE_2D, 0, groundGl.RGBA, groundGl.RGBA, groundGl.UNSIGNED_BYTE, groundCanvas); groundGl.texImage2D(groundGl.TEXTURE_2D, 0, groundGl.RGBA, groundGl.RGBA, groundGl.UNSIGNED_BYTE, groundCanvas);
groundGl.texParameteri(groundGl.TEXTURE_2D, groundGl.TEXTURE_WRAP_S, groundGl.CLAMP_TO_EDGE); groundGl.texParameteri(groundGl.TEXTURE_2D, groundGl.TEXTURE_WRAP_S, groundGl.CLAMP_TO_EDGE);
groundGl.texParameteri(groundGl.TEXTURE_2D, groundGl.TEXTURE_WRAP_T, groundGl.CLAMP_TO_EDGE); groundGl.texParameteri(groundGl.TEXTURE_2D, groundGl.TEXTURE_WRAP_T, groundGl.CLAMP_TO_EDGE);