summaryrefslogtreecommitdiffstats
path: root/src/graphics
diff options
context:
space:
mode:
authorDidier 'OdyX' Raboud <didier@raboud.com>2013-10-28 15:18:45 +0100
committerDidier Raboud <odyx@debian.org>2013-10-28 15:23:56 +0100
commit9e439d88bf81372ed38838dd406825ca24e7a183 (patch)
treefffd03356a275ff96c7dfefc2435d4c6391a1ed3 /src/graphics
parent19a7196b6131c418ecee72525939c43f37fc49d9 (diff)
downloadcolobot-9e439d88bf81372ed38838dd406825ca24e7a183.tar.gz
colobot-9e439d88bf81372ed38838dd406825ca24e7a183.tar.bz2
colobot-9e439d88bf81372ed38838dd406825ca24e7a183.zip
Fix the detection of alpha-channel in textures as created by IMG_Load
This fixes the textures loading under Mac OS X
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/opengl/gldevice.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index bbabdd6..9f64fab 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -606,7 +606,7 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
}
else if (params.format == TEX_IMG_AUTO)
{
- if (data->surface->format->Amask != 0)
+ if (data->surface->format->BytesPerPixel == 4)
{
if ((data->surface->format->Amask == 0xFF000000) &&
(data->surface->format->Rmask == 0x00FF0000) &&
@@ -630,7 +630,7 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
convert = true;
}
}
- else
+ else if (data->surface->format->BytesPerPixel == 3)
{
if ((data->surface->format->Rmask == 0xFF0000) &&
(data->surface->format->Gmask == 0x00FF00) &&
@@ -652,6 +652,10 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
convert = true;
}
}
+ else {
+ GetLogger()->Error("Unknown data surface format");
+ assert(false);
+ }
}
else
assert(false);