summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/image.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-03-09 09:08:41 -0700
committerBrian <[email protected]>2007-03-09 09:13:49 -0700
commitf9f79c8d770e696249bd98c68b563f887562c974 (patch)
treeeeb8fbfa43c0e33bfbc6113679cb1f49e418d1c0 /src/mesa/main/image.c
parent4d9901a1cab8e0d55b1b2309cf3ffec235e53149 (diff)
New IMAGE_RED_TO_LUMINANCE flag passed to _mesa_pack_rgba_span_float() to fix glGetTexImage(GL_LUMINANCE) bug #10232.
Diffstat (limited to 'src/mesa/main/image.c')
-rw-r--r--src/mesa/main/image.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index fc8e1f0f574..eb91ebb6110 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1182,15 +1182,24 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
/* compute luminance values */
- if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
+ if (transferOps & IMAGE_RED_TO_LUMINANCE) {
+ /* Luminance = Red (glGetTexImage) */
for (i = 0; i < n; i++) {
- GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- luminance[i] = CLAMP(sum, 0.0F, 1.0F);
+ luminance[i] = rgba[i][RCOMP];
}
}
else {
- for (i = 0; i < n; i++) {
- luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ /* Luminance = Red + Green + Blue (glReadPixels) */
+ if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
+ for (i = 0; i < n; i++) {
+ GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ luminance[i] = CLAMP(sum, 0.0F, 1.0F);
+ }
+ }
+ else {
+ for (i = 0; i < n; i++) {
+ luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ }
}
}
}