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:
parent
e97f7d1c6c
commit
efdb3ec72f
1 changed files with 9 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue