mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
d17636484d
commit
73de17afa8
5 changed files with 42 additions and 33 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue