aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-04-16 14:44:15 +0200
committerGitHub <noreply@github.com>2017-04-16 14:44:15 +0200
commit73de17afa821ccea84a119096b267e05a77db3ff (patch)
treeccb05343e11982058c8550533f6b54483be09474 /src/client
parentd17636484dedab91b820667a82ec23cf6168ac7a (diff)
downloadminetest-73de17afa821ccea84a119096b267e05a77db3ff.tar.gz
minetest-73de17afa821ccea84a119096b267e05a77db3ff.tar.bz2
minetest-73de17afa821ccea84a119096b267e05a77db3ff.zip
Android progressbar fix (#5601)
* Fix progressbar for Android Fixes #5599 Fixed #5403 * draw_load_screen: use texturesource this permits to unify texture loading code * scale progress bar * Add gl version check for GL_OES_texture_npot. This fixed the texture on loading screen * Remove two sanity checks pointed by @celeron55 * sfan5 comments + android ratio fixes
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;
}