1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

OpenGL: Make version number parsing slightly more robust

This fixes an issue on iOS platforms where the version number string is
prefixed with "OpenGL ES " despite the Khronos docs for OpenGL ES
specifying that "The GL_VERSION and GL_SHADING_LANGUAGE_VERSION strings
begin with a version number".
This commit is contained in:
reuk 2021-11-22 13:20:21 +00:00
parent e97f7d1c6c
commit efdb3ec72f
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -97,15 +97,18 @@ static Version getOpenGLVersion()
const std::string versionString (versionBegin, versionEnd);
const auto spaceSeparated = StringArray::fromTokens (versionString.c_str(), false);
if (spaceSeparated.isEmpty())
return {};
for (const auto& token : spaceSeparated)
{
const auto pointSeparated = StringArray::fromTokens (token, ".", "");
const auto pointSeparated = StringArray::fromTokens (spaceSeparated[0], ".", "");
const auto major = pointSeparated[0].getIntValue();
const auto minor = pointSeparated[1].getIntValue();
const auto major = pointSeparated[0].getIntValue();
const auto minor = pointSeparated[1].getIntValue();
if (major != 0)
return { major, minor };
}
return { major, minor };
return {};
}
void OpenGLHelpers::resetErrorState()