summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/graphicsmanager.cpp17
-rw-r--r--src/graphicsmanager.h5
2 files changed, 18 insertions, 4 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 7a6e97f1f..a5299ce1f 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -147,6 +147,7 @@ GraphicsManager::GraphicsManager() :
mTextureSampler(0),
mSupportDebug(0),
mSupportModernOpengl(false),
+ mGles(false),
#endif
mUseAtlases(false)
{
@@ -725,14 +726,16 @@ void GraphicsManager::updateTextureCompressionFormat() const
{
const int compressionFormat = config.getIntValue("compresstextures");
// using extensions if can
- if (checkGLVersion(3, 1) || supportExtension("GL_ARB_texture_compression"))
+ if (checkGLVersion(3, 1) ||
+ checkGLesVersion(2,0) ||
+ supportExtension("GL_ARB_texture_compression"))
{
GLint num = 0;
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num);
+ mglGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num);
logger->log("support %d compressed formats", num);
GLint *const formats = new GLint[num > 10
? static_cast<size_t>(num) : 10];
- glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
+ mglGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
for (int f = 0; f < num; f ++)
logger->log(" 0x%x", static_cast<unsigned int>(formats[f]));
@@ -842,7 +845,8 @@ void GraphicsManager::setGLVersion()
{
mGlVersionString = getGLString(GL_VERSION);
std::string version = mGlVersionString;
- cutFirst(version, "OpenGL ES ");
+ if (findCutFirst(version, "OpenGL ES "))
+ mGles = true;
sscanf(version.c_str(), "%5d.%5d", &mMajor, &mMinor);
logger->log("Detected gl version: %d.%d", mMajor, mMinor);
mGlVendor = getGLString(GL_VENDOR);
@@ -874,6 +878,11 @@ bool GraphicsManager::checkSLVersion(const int major, const int minor) const
return mSLMajor > major || (mSLMajor == major && mSLMinor >= minor);
}
+bool GraphicsManager::checkGLesVersion(const int major, const int minor) const
+{
+ return mGles && (mMajor > major || (mMajor == major && mMinor >= minor));
+}
+
bool GraphicsManager::checkPlatformVersion(const int major,
const int minor) const
{
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 1fe682d27..644b1ae87 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -103,6 +103,9 @@ class GraphicsManager final
bool checkGLVersion(const int major, const int minor)
const A_WARN_UNUSED;
+ bool checkGLesVersion(const int major, const int minor)
+ const A_WARN_UNUSED;
+
bool checkSLVersion(const int major, const int minor)
const A_WARN_UNUSED;
@@ -213,6 +216,8 @@ class GraphicsManager final
int mSupportDebug;
bool mSupportModernOpengl;
+
+ bool mGles;
#endif
bool mUseAtlases;
};