diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 7f8e4dc82..450682ce6 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -154,6 +154,7 @@ namespace graphics { { "canvas", Graphics::SUPPORT_CANVAS }, { "pixeleffect", Graphics::SUPPORT_PIXELEFFECT }, + { "npot", Graphics::SUPPORT_NPOT }, }; StringMap Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries)); diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index 0fe150d6f..f4bdb5dc5 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -83,6 +83,7 @@ namespace graphics { SUPPORT_CANVAS = 1, SUPPORT_PIXELEFFECT, + SUPPORT_NPOT, SUPPORT_MAX_ENUM }; diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index 06f572a21..0a684af96 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -278,7 +278,7 @@ namespace opengl bool Image::loadVolatile() { - if (GLEE_ARB_texture_non_power_of_two) + if (hasNpot()) return loadVolatileNPOT(); else return loadVolatilePOT(); @@ -387,6 +387,11 @@ namespace opengl glPopMatrix(); } + bool Image::hasNpot() + { + return GLEE_ARB_texture_non_power_of_two; + } + } // opengl } // graphics } // love diff --git a/src/modules/graphics/opengl/Image.h b/src/modules/graphics/opengl/Image.h index f3118b44a..1f134efdd 100644 --- a/src/modules/graphics/opengl/Image.h +++ b/src/modules/graphics/opengl/Image.h @@ -37,7 +37,6 @@ namespace graphics { namespace opengl { - /** * A drawable image based on OpenGL-textures. This class takes ImageData * objects and create textures on the GPU for fast drawing. @@ -138,6 +137,8 @@ namespace opengl bool loadVolatile(); void unloadVolatile(); + static bool hasNpot(); + private: void drawv(const Matrix & t, const vertex * v) const; diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 753ff6332..dfb2bc441 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -791,6 +791,10 @@ namespace opengl if (!PixelEffect::isSupported()) supported = false; break; + case Graphics::SUPPORT_NPOT: + if (!Image::hasNpot()) + supported = false; + break; default: supported = false; }