From 3fe392b41f17b2a49fdd830ef2aa77e91adf205f Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 29 Jun 2022 18:05:51 +0300 Subject: [PATCH] ref: fix processing indexed textures --- ref_gl/gl_image.c | 5 +++++ ref_soft/r_image.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ref_gl/gl_image.c b/ref_gl/gl_image.c index 1b5ed033..658b0240 100644 --- a/ref_gl/gl_image.c +++ b/ref_gl/gl_image.c @@ -1908,6 +1908,11 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor ) // all the operations makes over the image copy not an original pic = gEngfuncs.FS_CopyImage( image->original ); + + // we need to expand image into RGBA buffer + if( pic->type == PF_INDEXED_24 || pic->type == PF_INDEXED_32 ) + flags |= IMAGE_FORCE_RGBA; + gEngfuncs.Image_Process( &pic, topColor, bottomColor, flags, 0.0f ); GL_UploadTexture( image, pic ); diff --git a/ref_soft/r_image.c b/ref_soft/r_image.c index a374d401..247e2e1e 100644 --- a/ref_soft/r_image.c +++ b/ref_soft/r_image.c @@ -1186,6 +1186,11 @@ void GAME_EXPORT GL_ProcessTexture( int texnum, float gamma, int topColor, int b // all the operations makes over the image copy not an original pic = gEngfuncs.FS_CopyImage( image->original ); + + // we need to expand image into RGBA buffer + if( pic->type == PF_INDEXED_24 || pic->type == PF_INDEXED_32 ) + flags |= IMAGE_FORCE_RGBA; + gEngfuncs.Image_Process( &pic, topColor, bottomColor, flags, 0.0f ); GL_UploadTexture( image, pic );