mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Added methods GUI_App::is_gl_version_greater_or_equal_to() and GUI_App::is_glsl_version_greater_or_equal_to()
This commit is contained in:
parent
8a9dbb3414
commit
df010a1d4e
3 changed files with 23 additions and 6 deletions
|
@ -222,6 +222,9 @@ public:
|
|||
GLShaderProgram* get_current_shader() { return m_opengl_mgr.get_current_shader(); }
|
||||
#endif // ENABLE_SHADERS_MANAGER
|
||||
|
||||
bool is_gl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { return m_opengl_mgr.get_gl_info().is_version_greater_or_equal_to(major, minor); }
|
||||
bool is_glsl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { return m_opengl_mgr.get_gl_info().is_glsl_version_greater_or_equal_to(major, minor); }
|
||||
|
||||
private:
|
||||
bool on_init_inner();
|
||||
void init_app_config();
|
||||
|
|
|
@ -130,18 +130,15 @@ void OpenGLManager::GLInfo::detect() const
|
|||
m_detected = true;
|
||||
}
|
||||
|
||||
bool OpenGLManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const
|
||||
static bool version_greater_or_equal_to(const std::string& version, unsigned int major, unsigned int minor)
|
||||
{
|
||||
if (!m_detected)
|
||||
detect();
|
||||
|
||||
#if ENABLE_SHADERS_MANAGER
|
||||
if (m_version == "N/A")
|
||||
if (version == "N/A")
|
||||
return false;
|
||||
#endif // ENABLE_SHADERS_MANAGER
|
||||
|
||||
std::vector<std::string> tokens;
|
||||
boost::split(tokens, m_version, boost::is_any_of(" "), boost::token_compress_on);
|
||||
boost::split(tokens, version, boost::is_any_of(" "), boost::token_compress_on);
|
||||
|
||||
if (tokens.empty())
|
||||
return false;
|
||||
|
@ -166,6 +163,22 @@ bool OpenGLManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, u
|
|||
return gl_minor >= minor;
|
||||
}
|
||||
|
||||
bool OpenGLManager::GLInfo::is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const
|
||||
{
|
||||
if (!m_detected)
|
||||
detect();
|
||||
|
||||
return version_greater_or_equal_to(m_version, major, minor);
|
||||
}
|
||||
|
||||
bool OpenGLManager::GLInfo::is_glsl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const
|
||||
{
|
||||
if (!m_detected)
|
||||
detect();
|
||||
|
||||
return version_greater_or_equal_to(m_glsl_version, major, minor);
|
||||
}
|
||||
|
||||
std::string OpenGLManager::GLInfo::to_string(bool format_as_html, bool extensions) const
|
||||
{
|
||||
if (!m_detected)
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
float get_max_anisotropy() const;
|
||||
|
||||
bool is_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
||||
bool is_glsl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const;
|
||||
|
||||
std::string to_string(bool format_as_html, bool extensions) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue