From 294109628d87df8c151f956b4c6bbc3d2381ae39 Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Mon, 12 Dec 2016 15:33:54 -0800 Subject: [PATCH] OpenGL2: Fix bug in generating normal maps for non-square textures. --- code/renderergl2/tr_image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/renderergl2/tr_image.c b/code/renderergl2/tr_image.c index 42038339..0fa79612 100644 --- a/code/renderergl2/tr_image.c +++ b/code/renderergl2/tr_image.c @@ -502,11 +502,11 @@ static void RGBAtoNormal(const byte *in, byte *out, int width, int height, qbool if (clampToEdge) { - src_x = CLAMP(src_x, 0, height - 1); + src_x = CLAMP(src_x, 0, width - 1); } else { - src_x = (src_x + height) % height; + src_x = (src_x + width) % width; } s[i++] = *(out + (src_y * width + src_x) * 4 + 3);