From ca363d3ef805a39fe4e821813b1efa53b2c9c805 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 25 Jul 2019 00:01:25 +0200 Subject: Unify OpenGL ES support --- src/client/tile.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/client/tile.cpp') diff --git a/src/client/tile.cpp b/src/client/tile.cpp index 72f7358b1..82f989d89 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +#include #include "util/string.h" #include "util/container.h" #include "util/thread.h" @@ -34,8 +35,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "renderingengine.h" -#ifdef __ANDROID__ +#if ENABLE_GLES +#ifdef _IRR_COMPILE_WITH_OGLES1_ #include +#else +#include +#endif #endif /* @@ -595,7 +600,7 @@ u32 TextureSource::generateTexture(const std::string &name) video::ITexture *tex = NULL; if (img != NULL) { -#ifdef __ANDROID__ +#if ENABLE_GLES img = Align2Npot2(img, driver); #endif // Create texture from resulting image @@ -752,7 +757,7 @@ void TextureSource::rebuildImagesAndTextures() // Recreate textures for (TextureInfo &ti : m_textureinfo_cache) { video::IImage *img = generateImage(ti.name); -#ifdef __ANDROID__ +#if ENABLE_GLES img = Align2Npot2(img, driver); #endif // Create texture from resulting image @@ -989,8 +994,7 @@ video::IImage* TextureSource::generateImage(const std::string &name) return baseimg; } -#ifdef __ANDROID__ -#include +#if ENABLE_GLES /** * Check and align image to npot2 if required by hardware * @param image image to check for npot2 alignment @@ -998,7 +1002,7 @@ video::IImage* TextureSource::generateImage(const std::string &name) * @return image or copy of image aligned to npot2 */ -inline u16 get_GL_major_version() +static inline u16 get_GL_major_version() { const GLubyte *gl_version = glGetString(GL_VERSION); return (u16) (gl_version[0] - '0'); @@ -1078,7 +1082,7 @@ bool TextureSource::generateImagePart(std::string part_of_name, // Stuff starting with [ are special commands if (part_of_name.empty() || part_of_name[0] != '[') { video::IImage *image = m_sourcecache.getOrLoad(part_of_name); -#ifdef __ANDROID__ +#if ENABLE_GLES image = Align2Npot2(image, driver); #endif if (image == NULL) { -- cgit v1.2.3