summaryrefslogtreecommitdiffstats
path: root/src/graphics/opengl/gldevice.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-05-11 21:40:09 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2013-05-11 21:40:09 +0200
commitf7f6e10c704585c4652fda359dc225fbb95b6075 (patch)
tree90fb42ed8c766ca37ee383d74afc7167d852ec4f /src/graphics/opengl/gldevice.cpp
parentcc8ed2979b14449f2dcf2b85daa7f13612d1dd00 (diff)
downloadcolobot-f7f6e10c704585c4652fda359dc225fbb95b6075.tar.gz
colobot-f7f6e10c704585c4652fda359dc225fbb95b6075.tar.bz2
colobot-f7f6e10c704585c4652fda359dc225fbb95b6075.zip
Added check and warning about non-power-of-2 textures
Diffstat (limited to 'src/graphics/opengl/gldevice.cpp')
-rw-r--r--src/graphics/opengl/gldevice.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index df64e34..86f92b2 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -417,12 +417,16 @@ bool CGLDevice::GetLightEnabled(int index)
Texture CGLDevice::CreateTexture(CImage *image, const TextureCreateParams &params)
{
ImageData *data = image->GetData();
- if (data == NULL)
+ if (data == nullptr)
{
GetLogger()->Error("Invalid texture data\n");
return Texture(); // invalid texture
}
+ Math::IntPoint size = image->GetSize();
+ if (!Math::IsPowerOfTwo(size.x) || !Math::IsPowerOfTwo(size.y))
+ GetLogger()->Warn("Creating non-power-of-2 texture (%dx%d)!\n", size.x, size.y);
+
return CreateTexture(data, params);
}