diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index 94917b871..e27a6fd43 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -297,6 +297,7 @@ void FRenderState::ApplyFixedFunction() col.vec[3] *= (mObjectColor.a / 255.f); glColor4fv(col.vec); + glEnable(GL_BLEND); if (mAlphaThreshold > 0) { glEnable(GL_ALPHA_TEST); diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index ffef95b8a..c09038bf8 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -287,7 +287,7 @@ void gl_PrintStartupLog() for (int i = 0; i < 256; i++) { remap->Remap[i] = i; - remap->Palette[i] = PalEntry(i, 255, 255); + remap->Palette[i] = PalEntry(i, 255, 255, 255); } } diff --git a/src/gl/textures/gl_bitmap.cpp b/src/gl/textures/gl_bitmap.cpp index ee28e8911..0db901380 100644 --- a/src/gl/textures/gl_bitmap.cpp +++ b/src/gl/textures/gl_bitmap.cpp @@ -124,13 +124,17 @@ void FGLBitmap::CopyPixelData(int originx, int originy, const BYTE * patch, int if (translation > 0) { PalEntry *ptrans = GLTranslationPalette::GetPalette(translation); - if (ptrans) + if (ptrans && !alphatrans) { for (i = 0; i < 256; i++) { penew[i] = (ptrans[i] & 0xffffff) | (palette[i] & 0xff000000); } } + else if (ptrans) + { + memcpy(penew, ptrans, 256 * sizeof(PalEntry)); + } } else { diff --git a/src/gl/textures/gl_bitmap.h b/src/gl/textures/gl_bitmap.h index e8b06b833..3c045e5ad 100644 --- a/src/gl/textures/gl_bitmap.h +++ b/src/gl/textures/gl_bitmap.h @@ -7,23 +7,22 @@ class FGLBitmap : public FBitmap { - int translation; + int translation = 0; + bool alphatrans = false; public: FGLBitmap() { - translation = 0; } FGLBitmap(BYTE *buffer, int pitch, int width, int height) : FBitmap(buffer, pitch, width, height) { - translation = 0; } - void SetTranslationInfo(int _trans) + void SetTranslationInfo(int _trans, bool _alphatrans = false) { if (_trans != -1337) translation = _trans; - + alphatrans = _alphatrans; } virtual void CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int srcwidth, diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 961a61c04..55ed91e4e 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -182,7 +182,7 @@ void FGLTexture::Clean(bool all) // //=========================================================================== -unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, FTexture *hirescheck, bool createexpanded) +unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, FTexture *hirescheck, bool createexpanded, bool alphatrans) { unsigned char * buffer; int W, H; @@ -190,7 +190,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F // Textures that are already scaled in the texture lump will not get replaced // by hires textures - if (gl_texture_usehires && hirescheck != NULL) + if (gl_texture_usehires && hirescheck != NULL && !alphatrans) { buffer = LoadHiresTexture (hirescheck, &w, &h); if (buffer) @@ -209,7 +209,7 @@ unsigned char * FGLTexture::CreateTexBuffer(int translation, int & w, int & h, F memset(buffer, 0, W * (H+1) * 4); FGLBitmap bmp(buffer, W*4, W, H); - bmp.SetTranslationInfo(translation); + bmp.SetTranslationInfo(translation, alphatrans); if (tex->bComplex) { @@ -275,9 +275,14 @@ FHardwareTexture *FGLTexture::CreateHwTexture() const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int translation, FTexture *hirescheck) { int usebright = false; + bool alphatrans = false; if (translation <= 0) translation = -translation; - else translation = GLTranslationPalette::GetInternalTranslation(translation); + else + { + alphatrans = (gl.glslversion == 0 && translation == TRANSLATION(TRANSLATION_Standard, 8)); + translation = GLTranslationPalette::GetInternalTranslation(translation); + } bool needmipmap = (clampmode <= CLAMP_XY) || !(gl.flags & RFL_SAMPLER_OBJECTS); @@ -303,7 +308,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla if (!tex->bHasCanvas) { - buffer = CreateTexBuffer(translation, w, h, hirescheck); + buffer = CreateTexBuffer(translation, w, h, hirescheck, true, alphatrans); tex->ProcessData(buffer, w, h, false); } if (!hwtex->CreateTexture(buffer, w, h, texunit, needmipmap, translation)) diff --git a/src/gl/textures/gl_material.h b/src/gl/textures/gl_material.h index 9cd2d3387..79e5f52e2 100644 --- a/src/gl/textures/gl_material.h +++ b/src/gl/textures/gl_material.h @@ -77,7 +77,7 @@ public: FGLTexture(FTexture * tx, bool expandpatches); ~FGLTexture(); - unsigned char * CreateTexBuffer(int translation, int & w, int & h, FTexture *hirescheck, bool createexpanded = true); + unsigned char * CreateTexBuffer(int translation, int & w, int & h, FTexture *hirescheck, bool createexpanded = true, bool alphatrans = false); void Clean(bool all); int Dump(int i);