From d3f675581f630dfc42a21975e76bc787abea7c4a Mon Sep 17 00:00:00 2001 From: Erik Duijs Date: Mon, 3 May 2004 09:55:45 +0000 Subject: [PATCH] Fixed up- scaling (thanks to Tom Robert Bryntesen) --- src/java/org/lwjgl/opengl/glu/MipMap.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/java/org/lwjgl/opengl/glu/MipMap.java b/src/java/org/lwjgl/opengl/glu/MipMap.java index abc44a84..4940964e 100644 --- a/src/java/org/lwjgl/opengl/glu/MipMap.java +++ b/src/java/org/lwjgl/opengl/glu/MipMap.java @@ -247,9 +247,18 @@ public class MipMap extends Util { // store weighted pixel dst = (iy * widthOut + ix) * components; - for (k = 0; k < components; k++) { - tempout[dst++] = c[k] / readPix; - } + if (readPix == 0) { + // Image is sized up, caused by non power of two texture as input + src = (y0 * widthIn + x0) * components; + for (int ic = 0; ic < components; ic++) { + tempout[dst++] = tempin[src + ic]; + } + } else { + // sized down + for (k = 0; k < components; k++) { + tempout[dst++] = c[k] / readPix; + } + } } }