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.
This commit is contained in:
Zack Middleton 2018-07-20 23:40:07 -05:00
parent bead4aa8c7
commit 476134f5a6
2 changed files with 4 additions and 16 deletions

View file

@ -206,7 +206,6 @@ void R_ImageList_f( void ) {
estSize *= 4; estSize *= 4;
break; break;
case GL_LUMINANCE8: case GL_LUMINANCE8:
case GL_LUMINANCE16:
case GL_LUMINANCE: case GL_LUMINANCE:
format = "L "; format = "L ";
// 1 byte per pixel? // 1 byte per pixel?
@ -219,7 +218,6 @@ void R_ImageList_f( void ) {
estSize *= 3; estSize *= 3;
break; break;
case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE8_ALPHA8:
case GL_LUMINANCE16_ALPHA16:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
format = "LA "; format = "LA ";
// 2 bytes per pixel? // 2 bytes per pixel?
@ -684,10 +682,8 @@ static void Upload32( unsigned *data,
{ {
if(r_greyscale->integer) if(r_greyscale->integer)
{ {
if(r_texturebits->integer == 16) if(r_texturebits->integer == 16 || r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE8; internalFormat = GL_LUMINANCE8;
else if(r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE16;
else else
internalFormat = GL_LUMINANCE; internalFormat = GL_LUMINANCE;
} }
@ -719,10 +715,8 @@ static void Upload32( unsigned *data,
{ {
if(r_greyscale->integer) if(r_greyscale->integer)
{ {
if(r_texturebits->integer == 16) if(r_texturebits->integer == 16 || r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE8_ALPHA8; internalFormat = GL_LUMINANCE8_ALPHA8;
else if(r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE16_ALPHA16;
else else
internalFormat = GL_LUMINANCE_ALPHA; internalFormat = GL_LUMINANCE_ALPHA;
} }

View file

@ -222,7 +222,6 @@ void R_ImageList_f( void ) {
estSize *= 4; estSize *= 4;
break; break;
case GL_LUMINANCE8: case GL_LUMINANCE8:
case GL_LUMINANCE16:
case GL_LUMINANCE: case GL_LUMINANCE:
format = "L "; format = "L ";
// 1 byte per pixel? // 1 byte per pixel?
@ -235,7 +234,6 @@ void R_ImageList_f( void ) {
estSize *= 3; estSize *= 3;
break; break;
case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE8_ALPHA8:
case GL_LUMINANCE16_ALPHA16:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
format = "LA "; format = "LA ";
// 2 bytes per pixel? // 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_greyscale->integer)
{ {
if(r_texturebits->integer == 16) if(r_texturebits->integer == 16 || r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE8; internalFormat = GL_LUMINANCE8;
else if(r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE16;
else else
internalFormat = GL_LUMINANCE; internalFormat = GL_LUMINANCE;
} }
@ -1763,10 +1759,8 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm
{ {
if(r_greyscale->integer) if(r_greyscale->integer)
{ {
if(r_texturebits->integer == 16) if(r_texturebits->integer == 16 || r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE8_ALPHA8; internalFormat = GL_LUMINANCE8_ALPHA8;
else if(r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE16_ALPHA16;
else else
internalFormat = GL_LUMINANCE_ALPHA; internalFormat = GL_LUMINANCE_ALPHA;
} }