From f7f6e10c704585c4652fda359dc225fbb95b6075 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sat, 11 May 2013 21:40:09 +0200 Subject: Added check and warning about non-power-of-2 textures --- src/graphics/opengl/gldevice.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/graphics/opengl') 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 ¶ms) { 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); } -- cgit v1.2.3-1-g7c22