@@ -849,10 +849,13 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
849849 int mipWidth, mipHeight, mipLayers, mipSize, blockSize = 0 ;
850850 int i, c;
851851 const byte *scan;
852+
853+ bool isSRGB = image->bits & IF_SRGB;
854+ bool isAlpha = !( image->bits & IF_NOALPHA );
855+
852856 GLenum target;
853857 GLenum format = GL_RGBA;
854- GLenum internalFormat = GL_RGB;
855- bool isSRGB = image->bits & IF_SRGB;
858+ GLenum internalFormat = isAlpha ? GL_RGBA : GL_RGB;
856859
857860 static const vec4_t oneClampBorder = { 1 , 1 , 1 , 1 };
858861 static const vec4_t zeroClampBorder = { 0 , 0 , 0 , 1 };
@@ -1054,15 +1057,12 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
10541057 }
10551058 else
10561059 {
1057- // lightmap does not have alpha channel
1058- if ( image->bits & IF_LIGHTMAP )
1059- {
1060- internalFormat = GL_RGB8;
1061- }
1062- else
1063- {
1064- internalFormat = GL_RGBA8;
1065- }
1060+ internalFormat = GL_RGBA8;
1061+ }
1062+
1063+ if ( internalFormat == GL_RGBA8 && !isAlpha )
1064+ {
1065+ internalFormat = GL_RGB8;
10661066 }
10671067
10681068 // Detect formats.
@@ -2757,7 +2757,7 @@ static void R_CreateColorGradeImage()
27572757 }
27582758
27592759 imageParams_t imageParams = {};
2760- imageParams.bits = IF_NOPICMIP;
2760+ imageParams.bits = IF_NOPICMIP | IF_NOALPHA ;
27612761 imageParams.filterType = filterType_t::FT_LINEAR;
27622762 imageParams.wrapType = wrapTypeEnum_t::WT_EDGE_CLAMP;
27632763
0 commit comments