summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-29 17:50:31 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-29 17:50:31 +0300
commit11f9e4c95d1e30005240f6e00204faa93bb315db (patch)
tree450f25a32d52fd5840fdfcaf4729cdd3013496d3 /src
parent1dda8c604a46e39bf726dd88a7482988038f8b93 (diff)
downloadmanaverse-11f9e4c95d1e30005240f6e00204faa93bb315db.tar.gz
manaverse-11f9e4c95d1e30005240f6e00204faa93bb315db.tar.bz2
manaverse-11f9e4c95d1e30005240f6e00204faa93bb315db.tar.xz
manaverse-11f9e4c95d1e30005240f6e00204faa93bb315db.zip
Use power of two texture sizes in all OpenGL modes (even with rectangular textures)
Diffstat (limited to 'src')
-rw-r--r--src/resources/openglimagehelper.cpp14
-rw-r--r--src/resources/safeopenglimagehelper.cpp14
2 files changed, 6 insertions, 22 deletions
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 06c40388b..38e1a6e9a 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -132,17 +132,9 @@ Image *OpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
int OpenGLImageHelper::powerOfTwo(const int input)
{
- int value;
- if (mTextureType == GL_TEXTURE_2D)
- {
- value = 1;
- while (value < input && value < mTextureSize)
- value <<= 1;
- }
- else
- {
- value = input;
- }
+ int value = 1;
+ while (value < input && value < mTextureSize)
+ value <<= 1;
return value >= mTextureSize ? mTextureSize : value;
}
diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp
index d83c1b711..0256e81ea 100644
--- a/src/resources/safeopenglimagehelper.cpp
+++ b/src/resources/safeopenglimagehelper.cpp
@@ -130,17 +130,9 @@ Image *SafeOpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
int SafeOpenGLImageHelper::powerOfTwo(const int input)
{
- int value;
- if (mTextureType == GL_TEXTURE_2D)
- {
- value = 1;
- while (value < input && value < mTextureSize)
- value <<= 1;
- }
- else
- {
- value = input;
- }
+ int value = 1;
+ while (value < input && value < mTextureSize)
+ value <<= 1;
return value >= mTextureSize ? mTextureSize : value;
}