diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-01 22:58:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-01 23:00:35 +0300 |
commit | 6863f21c65f416759afd77fb55d35df0cf8b5c29 (patch) | |
tree | 14379fae85adb5870575d1ca0bcfa46824b57884 /src | |
parent | edab962f4183b599c4c7c5beb75947589443ccca (diff) | |
download | mv-6863f21c65f416759afd77fb55d35df0cf8b5c29.tar.gz mv-6863f21c65f416759afd77fb55d35df0cf8b5c29.tar.bz2 mv-6863f21c65f416759afd77fb55d35df0cf8b5c29.tar.xz mv-6863f21c65f416759afd77fb55d35df0cf8b5c29.zip |
Fix OpenGL GLES version detection.
Diffstat (limited to 'src')
-rw-r--r-- | src/graphicsmanager.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 22850848d..719f072c6 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -764,11 +764,19 @@ std::string GraphicsManager::getGLString(const int num) void GraphicsManager::setGLVersion() { mGlVersionString = getGLString(GL_VERSION); - sscanf(mGlVersionString.c_str(), "%5d.%5d", &mMajor, &mMinor); + std::string version = mGlVersionString; + cutFirst(version, "OpenGL ES "); + sscanf(version.c_str(), "%5d.%5d", &mMajor, &mMinor); + logger->log("Detected gl version: %d.%d", mMajor, mMinor); mGlVendor = getGLString(GL_VENDOR); mGlRenderer = getGLString(GL_RENDERER); mGlShaderVersionString = getGLString(GL_SHADING_LANGUAGE_VERSION); - sscanf(mGlShaderVersionString.c_str(), "%5d.%5d", &mSLMajor, &mSLMinor); + version = mGlShaderVersionString; + cutFirst(version, "OpenGL ES GLSL ES "); + cutFirst(version, "OpenGL ES GLSL "); + cutFirst(version, "OpenGL ES "); + sscanf(version.c_str(), "%5d.%5d", &mSLMajor, &mSLMinor); + logger->log("Detected glsl version: %d.%d", mSLMajor, mSLMinor); } void GraphicsManager::logVersion() const @@ -1227,6 +1235,12 @@ void GraphicsManager::updateLimits() logger->log("GL_MAX_ELEMENTS_INDICES: %d", value); if (value < mMaxVertices) mMaxVertices = value; + if (!mMaxVertices) + { + logger->log("Got 0 max amount of vertices or indicies. " + "Overriding to 500"); + mMaxVertices = 500; + } value = 0; glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value); |