aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-04-21 18:52:14 +0200
committersfan5 <sfan5@live.de>2021-05-05 22:49:44 +0200
commit08f1a7fbed4139a0147a067d38af353935d79b57 (patch)
tree84f7c67460102e661f293baa0a366c7e2505054f /src/client
parentde85bc9227ef0db01854fa0eef89256646b4d578 (diff)
downloadminetest-08f1a7fbed4139a0147a067d38af353935d79b57.tar.gz
minetest-08f1a7fbed4139a0147a067d38af353935d79b57.tar.bz2
minetest-08f1a7fbed4139a0147a067d38af353935d79b57.zip
Use Irrlicht functions to query npot texture support
Diffstat (limited to 'src/client')
-rw-r--r--src/client/guiscalingfilter.cpp3
-rw-r--r--src/client/tile.cpp38
-rw-r--r--src/client/tile.h3
3 files changed, 5 insertions, 39 deletions
diff --git a/src/client/guiscalingfilter.cpp b/src/client/guiscalingfilter.cpp
index cf371d8ba..232219237 100644
--- a/src/client/guiscalingfilter.cpp
+++ b/src/client/guiscalingfilter.cpp
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/numeric.h"
#include <cstdio>
#include "client/renderingengine.h"
-#include "client/tile.h" // hasNPotSupport()
/* Maintain a static cache to store the images that correspond to textures
* in a format that's manipulable by code. Some platforms exhibit issues
@@ -117,7 +116,7 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
#if ENABLE_GLES
// Some platforms are picky about textures being powers of 2, so expand
// the image dimensions to the next power of 2, if necessary.
- if (!hasNPotSupport()) {
+ if (!driver->queryFeature(video::EVDF_TEXTURE_NPOT)) {
video::IImage *po2img = driver->createImage(src->getColorFormat(),
core::dimension2d<u32>(npot2((u32)destrect.getWidth()),
npot2((u32)destrect.getHeight())));
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index d9f8c75a7..96312ea27 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -34,15 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiscalingfilter.h"
#include "renderingengine.h"
-
-#if ENABLE_GLES
-#ifdef _IRR_COMPILE_WITH_OGLES1_
-#include <GLES/gl.h>
-#else
-#include <GLES2/gl2.h>
-#endif
-#endif
-
/*
A cache from texture name to texture path
*/
@@ -1013,42 +1004,19 @@ video::IImage* TextureSource::generateImage(const std::string &name)
#if ENABLE_GLES
-
-static inline u16 get_GL_major_version()
-{
- const GLubyte *gl_version = glGetString(GL_VERSION);
- return (u16) (gl_version[0] - '0');
-}
-
-/**
- * Check if hardware requires npot2 aligned textures
- * @return true if alignment NOT(!) requires, false otherwise
- */
-
-bool hasNPotSupport()
-{
- // Only GLES2 is trusted to correctly report npot support
- // Note: we cache the boolean result, the GL context will never change.
- static const bool supported = get_GL_major_version() > 1 &&
- glGetString(GL_EXTENSIONS) &&
- strstr((char *)glGetString(GL_EXTENSIONS), "GL_OES_texture_npot");
- return supported;
-}
-
/**
* Check and align image to npot2 if required by hardware
* @param image image to check for npot2 alignment
* @param driver driver to use for image operations
* @return image or copy of image aligned to npot2
*/
-
-video::IImage * Align2Npot2(video::IImage * image,
- video::IVideoDriver* driver)
+video::IImage *Align2Npot2(video::IImage *image,
+ video::IVideoDriver *driver)
{
if (image == NULL)
return image;
- if (hasNPotSupport())
+ if (driver->queryFeature(video::EVDF_TEXTURE_NPOT))
return image;
core::dimension2d<u32> dim = image->getDimension();
diff --git a/src/client/tile.h b/src/client/tile.h
index 49c46f749..fcdc46460 100644
--- a/src/client/tile.h
+++ b/src/client/tile.h
@@ -134,8 +134,7 @@ public:
IWritableTextureSource *createTextureSource();
#if ENABLE_GLES
-bool hasNPotSupport();
-video::IImage * Align2Npot2(video::IImage * image, irr::video::IVideoDriver* driver);
+video::IImage *Align2Npot2(video::IImage *image, video::IVideoDriver *driver);
#endif
enum MaterialType{