diff options
author | Piotr Dziwiński <piotrdz@gmail.com> | 2013-10-28 10:11:54 -0700 |
---|---|---|
committer | Piotr Dziwiński <piotrdz@gmail.com> | 2013-10-28 10:11:54 -0700 |
commit | 75871cc9cafb0dc03a7d34c1031a7dbfe7da8919 (patch) | |
tree | bf358908adf9171e361b13fef0babe0c99eaf91c /src/graphics | |
parent | 19a7196b6131c418ecee72525939c43f37fc49d9 (diff) | |
parent | c2a717d5c9adc3fb01fb42ca17ba14e65b955236 (diff) | |
download | colobot-75871cc9cafb0dc03a7d34c1031a7dbfe7da8919.tar.gz colobot-75871cc9cafb0dc03a7d34c1031a7dbfe7da8919.tar.bz2 colobot-75871cc9cafb0dc03a7d34c1031a7dbfe7da8919.zip |
Merge pull request #243 from OdyX/dev-fix-textures-loading
Fix the detection of alpha-channel in textures as created by IMG_Load
Diffstat (limited to 'src/graphics')
-rw-r--r-- | src/graphics/engine/engine.cpp | 2 | ||||
-rw-r--r-- | src/graphics/opengl/gldevice.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index e973eec..5cf7b23 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -276,7 +276,7 @@ bool CEngine::Create() Math::LoadOrthoProjectionMatrix(m_matProjInterface, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); TextureCreateParams params; - params.format = TEX_IMG_RGB; + params.format = TEX_IMG_AUTO; params.minFilter = TEX_MIN_FILTER_NEAREST; params.magFilter = TEX_MAG_FILTER_NEAREST; params.mipmap = false; 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); |