mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Centralize NPOT support check for image, export it to isSupported
This commit is contained in:
@@ -154,6 +154,7 @@ namespace graphics
|
|||||||
{
|
{
|
||||||
{ "canvas", Graphics::SUPPORT_CANVAS },
|
{ "canvas", Graphics::SUPPORT_CANVAS },
|
||||||
{ "pixeleffect", Graphics::SUPPORT_PIXELEFFECT },
|
{ "pixeleffect", Graphics::SUPPORT_PIXELEFFECT },
|
||||||
|
{ "npot", Graphics::SUPPORT_NPOT },
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries));
|
StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries));
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ namespace graphics
|
|||||||
{
|
{
|
||||||
SUPPORT_CANVAS = 1,
|
SUPPORT_CANVAS = 1,
|
||||||
SUPPORT_PIXELEFFECT,
|
SUPPORT_PIXELEFFECT,
|
||||||
|
SUPPORT_NPOT,
|
||||||
SUPPORT_MAX_ENUM
|
SUPPORT_MAX_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ namespace opengl
|
|||||||
|
|
||||||
bool Image::loadVolatile()
|
bool Image::loadVolatile()
|
||||||
{
|
{
|
||||||
if (GLEE_ARB_texture_non_power_of_two)
|
if (hasNpot())
|
||||||
return loadVolatileNPOT();
|
return loadVolatileNPOT();
|
||||||
else
|
else
|
||||||
return loadVolatilePOT();
|
return loadVolatilePOT();
|
||||||
@@ -387,6 +387,11 @@ namespace opengl
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Image::hasNpot()
|
||||||
|
{
|
||||||
|
return GLEE_ARB_texture_non_power_of_two;
|
||||||
|
}
|
||||||
|
|
||||||
} // opengl
|
} // opengl
|
||||||
} // graphics
|
} // graphics
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ namespace graphics
|
|||||||
{
|
{
|
||||||
namespace opengl
|
namespace opengl
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A drawable image based on OpenGL-textures. This class takes ImageData
|
* A drawable image based on OpenGL-textures. This class takes ImageData
|
||||||
* objects and create textures on the GPU for fast drawing.
|
* objects and create textures on the GPU for fast drawing.
|
||||||
@@ -138,6 +137,8 @@ namespace opengl
|
|||||||
bool loadVolatile();
|
bool loadVolatile();
|
||||||
void unloadVolatile();
|
void unloadVolatile();
|
||||||
|
|
||||||
|
static bool hasNpot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void drawv(const Matrix & t, const vertex * v) const;
|
void drawv(const Matrix & t, const vertex * v) const;
|
||||||
|
|||||||
@@ -791,6 +791,10 @@ namespace opengl
|
|||||||
if (!PixelEffect::isSupported())
|
if (!PixelEffect::isSupported())
|
||||||
supported = false;
|
supported = false;
|
||||||
break;
|
break;
|
||||||
|
case Graphics::SUPPORT_NPOT:
|
||||||
|
if (!Image::hasNpot())
|
||||||
|
supported = false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
supported = false;
|
supported = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user