diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 80a990fb8c..44f1c28d34 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -184,18 +184,14 @@ int CLI::run(int argc, char **argv) it = std::find(m_actions.begin(), m_actions.end(), "opengl-version"); if (it != m_actions.end()) { - std::string opengl_version_str = m_config.opt_string("opengl-version"); - if (std::find(Slic3r::GUI::OpenGLVersions::core_str.begin(), Slic3r::GUI::OpenGLVersions::core_str.end(), opengl_version_str) == Slic3r::GUI::OpenGLVersions::core_str.end()) { - boost::nowide::cerr << "Required OpenGL version " << opengl_version_str << " is invalid. Must be greater than or equal to 3.2" << std::endl; - opengl_version_str.clear(); - } - - if (!opengl_version_str.empty()) { - std::vector tokens; - boost::split(tokens, opengl_version_str, boost::is_any_of("."), boost::token_compress_on); - opengl_version.first = std::stoi(tokens[0].c_str()); - opengl_version.second = std::stoi(tokens[1].c_str()); - } + const Semver opengl_minimum = Semver(3,2,0); + const std::string opengl_version_str = m_config.opt_string("opengl-version"); + boost::optional semver = Semver::parse(opengl_version_str); + if (semver.has_value() && (*semver) >= opengl_minimum ) { + opengl_version.first = semver->maj(); + opengl_version.second = semver->min(); + } else + boost::nowide::cerr << "Required OpenGL version " << opengl_version_str << " is invalid. Must be greater than or equal to " << opengl_minimum.to_string() << std::endl; start_gui = true; m_actions.erase(it); } diff --git a/src/slic3r/GUI/GUI_Init.cpp b/src/slic3r/GUI/GUI_Init.cpp index 6f734388e4..504a42a932 100644 --- a/src/slic3r/GUI/GUI_Init.cpp +++ b/src/slic3r/GUI/GUI_Init.cpp @@ -30,11 +30,7 @@ namespace Slic3r { namespace GUI { -const std::vector OpenGLVersions::core_str = { "3.2", "3.3", "4.0", "4.1", "4.2", "4.3", "4.4", "4.5", "4.6" }; -const std::vector OpenGLVersions::precore_str = { "2.0", "2.1", "3.0", "3.1" }; - const std::vector> OpenGLVersions::core = { {3,2}, {3,3}, {4,0}, {4,1}, {4,2}, {4,3}, {4,4}, {4,5}, {4,6} }; -const std::vector> OpenGLVersions::precore = { {2,0}, {2,1}, {3,0}, {3,1} }; int GUI_Run(GUI_InitParams ¶ms) { diff --git a/src/slic3r/GUI/GUI_Init.hpp b/src/slic3r/GUI/GUI_Init.hpp index 30c24d2bee..b21da42a5e 100644 --- a/src/slic3r/GUI/GUI_Init.hpp +++ b/src/slic3r/GUI/GUI_Init.hpp @@ -14,11 +14,7 @@ namespace GUI { struct OpenGLVersions { - static const std::vector core_str; - static const std::vector precore_str; - static const std::vector> core; - static const std::vector> precore; }; struct GUI_InitParams