aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/tile.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index 0aa06980c..509da3c92 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -790,8 +790,6 @@ void TextureSource::rebuildImagesAndTextures()
video::IImage *img = generateImage(ti->name);
#ifdef __ANDROID__
img = Align2Npot2(img, driver);
- sanity_check(img->getDimension().Height == npot2(img->getDimension().Height));
- sanity_check(img->getDimension().Width == npot2(img->getDimension().Width));
#endif
// Create texture from resulting image
video::ITexture *t = NULL;
@@ -1124,6 +1122,14 @@ video::IImage* TextureSource::generateImage(const std::string &name)
* @param driver driver to use for image operations
* @return image or copy of image aligned to npot2
*/
+
+inline u16 get_GL_major_version()
+{
+ const GLubyte *gl_version = glGetString(GL_VERSION);
+ std::string gl_ver((const char *)gl_version);
+ return (u16) (gl_version[0] - '0');
+}
+
video::IImage * Align2Npot2(video::IImage * image,
video::IVideoDriver* driver)
{
@@ -1134,7 +1140,10 @@ video::IImage * Align2Npot2(video::IImage * image,
core::dimension2d<u32> dim = image->getDimension();
std::string extensions = (char*) glGetString(GL_EXTENSIONS);
- if (extensions.find("GL_OES_texture_npot") != std::string::npos) {
+
+ // Only GLES2 is trusted to correctly report npot support
+ if (get_GL_major_version() > 1 &&
+ extensions.find("GL_OES_texture_npot") != std::string::npos) {
return image;
}