- changed alpha texture handling to avoid using the deprecated GL_ALPHA8 texture format unless we have a compatibility context of an older GL version.
This commit is contained in:
parent
ca76c2525e
commit
d5dceb6874
4 changed files with 50 additions and 9 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/textures/gl_translate.h"
|
||||
#include "gl/textures/gl_bitmap.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
@ -54,7 +55,7 @@ void iCopyColors(unsigned char * pout, const unsigned char * pin, bool alphatex,
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!alphatex)
|
||||
if (!alphatex || gl.version >= 3.3f) // GL 3.3+ uses a GL_R8 texture for alpha textures so the channels can remain as they are.
|
||||
{
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
|
|
@ -139,12 +140,25 @@ void FGLBitmap::CopyPixelData(int originx, int originy, const BYTE * patch, int
|
|||
// alpha map with 0==transparent and 1==opaque
|
||||
if (alphatex)
|
||||
{
|
||||
for(int i=0;i<256;i++)
|
||||
if (gl.version < 3.3f)
|
||||
{
|
||||
if (palette[i].a != 0)
|
||||
penew[i]=PalEntry(i, 255,255,255);
|
||||
else
|
||||
penew[i]=PalEntry(0,255,255,255); // If the palette contains transparent colors keep them.
|
||||
for (int i = 0; i<256; i++)
|
||||
{
|
||||
if (palette[i].a != 0)
|
||||
penew[i] = PalEntry(i, 255, 255, 255);
|
||||
else
|
||||
penew[i] = PalEntry(0, 255, 255, 255); // If the palette contains transparent colors keep them.
|
||||
}
|
||||
}
|
||||
else // on GL 3.3+ we use a GL_R8 texture so the layout is different.
|
||||
{
|
||||
for (int i = 0; i<256; i++)
|
||||
{
|
||||
if (palette[i].a != 0)
|
||||
penew[i] = PalEntry(255, i, 255, 255);
|
||||
else
|
||||
penew[i] = PalEntry(255, 0, 255, 255); // If the palette contains transparent colors keep them.
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (translation > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue