summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-07-22 21:24:31 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-07-23 08:21:41 +0200
commit2efaa748e8bd8f4678dd15380794ae69c84c7c53 (patch)
treeb29a5f6ad9671b2ceead864fd14a44c31dc8f536 /src/resources
parent236b87b8208349a3853866102e7a0b34544e84c7 (diff)
downloadmana-2efaa748e8bd8f4678dd15380794ae69c84c7c53.tar.gz
mana-2efaa748e8bd8f4678dd15380794ae69c84c7c53.tar.bz2
mana-2efaa748e8bd8f4678dd15380794ae69c84c7c53.tar.xz
mana-2efaa748e8bd8f4678dd15380794ae69c84c7c53.zip
Added support for ARB_texture_non_power_of_two extension
If the graphics driver supports this, there is no need to create textures with power-of-two dimensions. It is then also preferred to use regular textures than relying on the older GL_ARB_texture_rectangle extension.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/image.cpp3
-rw-r--r--src/resources/image.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 9a3e2ba2..3afa479f 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -36,6 +36,7 @@
#ifdef USE_OPENGL
bool Image::mUseOpenGL = false;
+bool Image::mPowerOfTwoTextures = true;
int Image::mTextureType = 0;
int Image::mTextureSize = 0;
#endif
@@ -544,7 +545,7 @@ void Image::setLoadAsOpenGL(bool useOpenGL)
int Image::powerOfTwo(int input)
{
int value;
- if (mTextureType == GL_TEXTURE_2D)
+ if (mPowerOfTwoTextures)
{
value = 1;
while (value < input && value < mTextureSize)
diff --git a/src/resources/image.h b/src/resources/image.h
index 7df74c3f..33db7848 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -249,6 +249,7 @@ class Image : public Resource
int mTexWidth, mTexHeight;
static bool mUseOpenGL;
+ static bool mPowerOfTwoTextures;
static int mTextureType;
static int mTextureSize;
#endif