From 476134f5a68dae222526930fe88e3550e15bbf34 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 20 Jul 2018 23:40:07 -0500 Subject: [PATCH] Don't upload 8 bit grayscale images as 16 bit luminance Using more color bits than the source image provides shouldn't improve the quality. --- code/renderergl1/tr_image.c | 10 ++-------- code/renderergl2/tr_image.c | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/code/renderergl1/tr_image.c b/code/renderergl1/tr_image.c index 44816f15..9603ff71 100644 --- a/code/renderergl1/tr_image.c +++ b/code/renderergl1/tr_image.c @@ -206,7 +206,6 @@ void R_ImageList_f( void ) { estSize *= 4; break; case GL_LUMINANCE8: - case GL_LUMINANCE16: case GL_LUMINANCE: format = "L "; // 1 byte per pixel? @@ -219,7 +218,6 @@ void R_ImageList_f( void ) { estSize *= 3; break; case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE16_ALPHA16: case GL_LUMINANCE_ALPHA: format = "LA "; // 2 bytes per pixel? @@ -684,10 +682,8 @@ static void Upload32( unsigned *data, { if(r_greyscale->integer) { - if(r_texturebits->integer == 16) + if(r_texturebits->integer == 16 || r_texturebits->integer == 32) internalFormat = GL_LUMINANCE8; - else if(r_texturebits->integer == 32) - internalFormat = GL_LUMINANCE16; else internalFormat = GL_LUMINANCE; } @@ -719,10 +715,8 @@ static void Upload32( unsigned *data, { if(r_greyscale->integer) { - if(r_texturebits->integer == 16) + if(r_texturebits->integer == 16 || r_texturebits->integer == 32) internalFormat = GL_LUMINANCE8_ALPHA8; - else if(r_texturebits->integer == 32) - internalFormat = GL_LUMINANCE16_ALPHA16; else internalFormat = GL_LUMINANCE_ALPHA; } diff --git a/code/renderergl2/tr_image.c b/code/renderergl2/tr_image.c index 90931877..d4cd7b11 100644 --- a/code/renderergl2/tr_image.c +++ b/code/renderergl2/tr_image.c @@ -222,7 +222,6 @@ void R_ImageList_f( void ) { estSize *= 4; break; case GL_LUMINANCE8: - case GL_LUMINANCE16: case GL_LUMINANCE: format = "L "; // 1 byte per pixel? @@ -235,7 +234,6 @@ void R_ImageList_f( void ) { estSize *= 3; break; case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE16_ALPHA16: case GL_LUMINANCE_ALPHA: format = "LA "; // 2 bytes per pixel? @@ -1724,10 +1722,8 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm { if(r_greyscale->integer) { - if(r_texturebits->integer == 16) + if(r_texturebits->integer == 16 || r_texturebits->integer == 32) internalFormat = GL_LUMINANCE8; - else if(r_texturebits->integer == 32) - internalFormat = GL_LUMINANCE16; else internalFormat = GL_LUMINANCE; } @@ -1763,10 +1759,8 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm { if(r_greyscale->integer) { - if(r_texturebits->integer == 16) + if(r_texturebits->integer == 16 || r_texturebits->integer == 32) internalFormat = GL_LUMINANCE8_ALPHA8; - else if(r_texturebits->integer == 32) - internalFormat = GL_LUMINANCE16_ALPHA16; else internalFormat = GL_LUMINANCE_ALPHA; }