ENH: CLI: don't popup dialog when loading shader failed
STUDIO-2855(github issue-1703) Change-Id: I46476e94951aa2337fee3439159e777773366c59
This commit is contained in:
parent
8dae5b6980
commit
33ae019a95
3 changed files with 20 additions and 15 deletions
|
@ -2329,7 +2329,7 @@ int CLI::run(int argc, char **argv)
|
|||
//opengl manager related logic
|
||||
{
|
||||
Slic3r::GUI::OpenGLManager opengl_mgr;
|
||||
bool opengl_valid = opengl_mgr.init_gl();
|
||||
bool opengl_valid = opengl_mgr.init_gl(false);
|
||||
if (!opengl_valid) {
|
||||
BOOST_LOG_TRIVIAL(error) << "init opengl failed! skip thumbnail generating" << std::endl;
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ OpenGLManager::~OpenGLManager()
|
|||
#endif //__APPLE__
|
||||
}
|
||||
|
||||
bool OpenGLManager::init_gl()
|
||||
bool OpenGLManager::init_gl(bool popup_error)
|
||||
{
|
||||
if (!m_gl_initialized) {
|
||||
GLenum result = glewInit();
|
||||
|
@ -263,25 +263,30 @@ bool OpenGLManager::init_gl()
|
|||
|
||||
bool valid_version = s_gl_info.is_version_greater_or_equal_to(2, 0);
|
||||
if (!valid_version) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "Found opengl version <= 2.0"<< std::endl;
|
||||
BOOST_LOG_TRIVIAL(error) << "Found opengl version <= 2.0"<< std::endl;
|
||||
// Complain about the OpenGL version.
|
||||
if (popup_error) {
|
||||
wxString message = from_u8((boost::format(
|
||||
_utf8(L("The application cannot run normally because OpenGL version is lower than 2.0.\n")))).str());
|
||||
message += "\n";
|
||||
message += _L("Please upgrade your graphics card driver.");
|
||||
wxMessageBox(message, _L("Unsupported OpenGL version"), wxOK | wxICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (valid_version)
|
||||
{
|
||||
// load shaders
|
||||
auto [result, error] = m_shaders_manager.init();
|
||||
if (!result) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Unable to load shaders: "<<error<< std::endl;
|
||||
if (popup_error) {
|
||||
wxString message = from_u8((boost::format(
|
||||
_utf8(L("Unable to load shaders:\n%s"))) % error).str());
|
||||
wxMessageBox(message, _L("Error loading shaders"), wxOK | wxICON_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Since AMD driver version 22.7.1, there is probably some bug in the driver that causes the issue with the missing
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
OpenGLManager() = default;
|
||||
~OpenGLManager();
|
||||
|
||||
bool init_gl();
|
||||
bool init_gl(bool popup_error = true);
|
||||
wxGLContext* init_glcontext(wxGLCanvas& canvas);
|
||||
|
||||
GLShaderProgram* get_shader(const std::string& shader_name) { return m_shaders_manager.get_shader(shader_name); }
|
||||
|
|
Loading…
Reference in a new issue