@@ -1054,17 +1054,14 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
10541054 }
10551055 else
10561056 {
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- }
1057+ internalFormat = GL_RGBA8;
10661058 }
10671059
1060+ if ( internalFormat == GL_RGBA8 && image->bits & IF_NOALPHA )
1061+ {
1062+ internalFormat = GL_RGB8;
1063+ }
1064+
10681065 if ( internalFormat == GL_RGB8 )
10691066 {
10701067 c = image->width * image->height ;
@@ -2776,13 +2773,13 @@ void R_CreateBuiltinImages()
27762773 memset ( data, 255 , sizeof ( data ) );
27772774
27782775 imageParams_t imageParams = {};
2779- imageParams.bits = IF_NOPICMIP;
2776+ imageParams.bits = IF_NOPICMIP | IF_NOALPHA ;
27802777 imageParams.filterType = filterType_t::FT_LINEAR;
27812778 imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
27822779
27832780 tr.whiteImage = R_CreateImage ( " _white" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION, 1 , imageParams );
27842781
2785- imageParams.bits = IF_NOPICMIP | IF_RED;
2782+ imageParams.bits = IF_NOPICMIP | IF_NOALPHA | IF_RED;
27862783
27872784 // we use a solid black image instead of disabling texturing
27882785 memset ( data, 0 , sizeof ( data ) );
@@ -2804,7 +2801,7 @@ void R_CreateBuiltinImages()
28042801 out[ 1 ] = out[ 3 ] = 255 ;
28052802 }
28062803
2807- imageParams.bits = IF_NOPICMIP;
2804+ imageParams.bits = IF_NOPICMIP | IF_NOALPHA ;
28082805
28092806 tr.greenImage = R_CreateImage ( " _green" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION, 1 , imageParams );
28102807
@@ -2825,11 +2822,11 @@ void R_CreateBuiltinImages()
28252822 out[ 3 ] = 255 ;
28262823 }
28272824
2828- imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
2825+ imageParams.bits = IF_NOPICMIP | IF_NOALPHA | IF_NORMALMAP;
28292826
28302827 tr.flatImage = R_CreateImage ( " _flat" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION, 1 , imageParams );
28312828
2832- imageParams.bits = IF_NOPICMIP;
2829+ imageParams.bits = IF_NOPICMIP | IF_NOALPHA ;
28332830 imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;
28342831
28352832 for ( image_t * &image : tr.cinematicImage )
0 commit comments