Browse Source

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".
v6.1.6
reuk 4 years ago
parent
commit
efdb3ec72f
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
1 changed files with 9 additions and 6 deletions
  1. +9
    -6
      modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp

+ 9
- 6
modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp 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()


Loading…
Cancel
Save