OpenGL2: Fix r_grayscale 1 making everything solid black

Using LUMINANCE with OpenGL 3.2 Core contex results in all images being
solid black (in the menu, world, and the console). In the end the whole
screen was solid black except the intro video.

Store images in RGB and RGBA instead. This doesn't affect r_grayscale
visually. If there is issues with it now possibly using compressed
formats, then it would already be an issue for r_grayscale 0.9.
This commit is contained in:
Zack Middleton 2021-10-23 06:15:36 -04:00
parent de055995d0
commit f9ba7c667d

View file

@ -1705,7 +1705,9 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm
}
else if(lightMap)
{
if(r_greyscale->integer)
// GL_LUMINANCE is not valid for OpenGL 3.2 Core context and
// everything becomes solid black
if(0 && r_greyscale->integer)
internalFormat = GL_LUMINANCE;
else
internalFormat = GL_RGBA;
@ -1720,7 +1722,7 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm
// select proper internal format
if ( samples == 3 )
{
if(r_greyscale->integer)
if(0 && r_greyscale->integer)
{
if(r_texturebits->integer == 16 || r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE8;
@ -1757,7 +1759,7 @@ static GLenum RawImage_GetFormat(const byte *data, int numPixels, GLenum picForm
}
else if ( samples == 4 )
{
if(r_greyscale->integer)
if(0 && r_greyscale->integer)
{
if(r_texturebits->integer == 16 || r_texturebits->integer == 32)
internalFormat = GL_LUMINANCE8_ALPHA8;