summaryrefslogtreecommitdiff
path: root/src/openglgraphics.cpp
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/openglgraphics.cpp
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/openglgraphics.cpp')
-rw-r--r--src/openglgraphics.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 9844dc7c..e0092f9e 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -126,14 +126,17 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
char const *glExtensions = (char const *)glGetString(GL_EXTENSIONS);
GLint texSize;
bool rectTex = strstr(glExtensions, "GL_ARB_texture_rectangle");
- if (rectTex)
+ bool npotTex = strstr(glExtensions, "GL_ARB_texture_non_power_of_two");
+ if (rectTex && !npotTex)
{
Image::mTextureType = GL_TEXTURE_RECTANGLE_ARB;
+ Image::mPowerOfTwoTextures = false;
glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &texSize);
}
else
{
Image::mTextureType = GL_TEXTURE_2D;
+ Image::mPowerOfTwoTextures = !npotTex;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
}
Image::mTextureSize = texSize;