- fixed creation of true color textures and disabled fog in palette mode.

The fog should go away entirely but in palette mode it made everything too dark.
This commit is contained in:
Christoph Oelckers 2019-10-18 22:09:19 +02:00
parent 2ed722f329
commit 00d59459a1
5 changed files with 70 additions and 14 deletions

View file

@ -65,14 +65,14 @@ unsigned int FHardwareTexture::CreateTexture(int w, int h, bool eightbit, bool m
//
//===========================================================================
unsigned int FHardwareTexture::LoadTexture(const unsigned char * buffer)
unsigned int FHardwareTexture::LoadTexture(const unsigned char * buffer, bool bgra)
{
return LoadTexturePart(buffer, 0, 0, mWidth, mHeight);
return LoadTexturePart(buffer, 0, 0, mWidth, mHeight, bgra);
}
unsigned int FHardwareTexture::LoadTexture(FBitmap& bmp)
unsigned int FHardwareTexture::LoadTexture(FBitmap& bmp, bool bgra)
{
return LoadTexture(bmp.GetPixels());
return LoadTexture(bmp.GetPixels(), bgra);
}
//===========================================================================
@ -81,12 +81,12 @@ unsigned int FHardwareTexture::LoadTexture(FBitmap& bmp)
//
//===========================================================================
unsigned int FHardwareTexture::LoadTexturePart(const unsigned char* buffer, int x, int y, int w, int h)
unsigned int FHardwareTexture::LoadTexturePart(const unsigned char* buffer, int x, int y, int w, int h, bool bgra)
{
if (glTexID == 0) return 0;
int dstformat = glTextureBytes == 1 ? GL_R8 : GL_RGBA8;// TexFormat[gl_texture_format];
int srcformat = glTextureBytes == 1 ? GL_RED : GL_BGRA;// TexFormat[gl_texture_format];
int srcformat = glTextureBytes == 1 ? GL_RED : (bgra ? GL_BGRA : GL_RGBA);// TexFormat[gl_texture_format];
glActiveTexture(GL_TEXTURE15);
glBindTexture(GL_TEXTURE_2D, glTexID);