ENH: add protect logic in post_init to check opengl resource
when the opengl context not ready postpone the GLCanvas3D's init Change-Id: I68b9d70f08e4ba0076a64aca59612a3f613070ff (cherry picked from commit 446a384dcc74af8184ee0a1af6668626d13413e9)
This commit is contained in:
parent
1cb64c15a0
commit
67d95d3fc8
|
@ -1054,9 +1054,9 @@ void GUI_App::post_init()
|
||||||
mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
mainframe->select_tab(size_t(MainFrame::tp3DEditor));
|
||||||
plater_->select_view_3D("3D");
|
plater_->select_view_3D("3D");
|
||||||
//BBS init the opengl resource here
|
//BBS init the opengl resource here
|
||||||
#ifdef __linux__
|
//#ifdef __linux__
|
||||||
if (plater_->canvas3D()->get_wxglcanvas()->IsShownOnScreen()&&plater_->canvas3D()->make_current_for_postinit()) {
|
if (plater_->canvas3D()->get_wxglcanvas()->IsShownOnScreen()&&plater_->canvas3D()->make_current_for_postinit()) {
|
||||||
#endif
|
//#endif
|
||||||
Size canvas_size = plater_->canvas3D()->get_canvas_size();
|
Size canvas_size = plater_->canvas3D()->get_canvas_size();
|
||||||
wxGetApp().imgui()->set_display_size(static_cast<float>(canvas_size.get_width()), static_cast<float>(canvas_size.get_height()));
|
wxGetApp().imgui()->set_display_size(static_cast<float>(canvas_size.get_width()), static_cast<float>(canvas_size.get_height()));
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", start to init opengl";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", start to init opengl";
|
||||||
|
@ -1076,9 +1076,12 @@ void GUI_App::post_init()
|
||||||
plater_->canvas3D()->render(false);
|
plater_->canvas3D()->render(false);
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished rendering a first frame for test";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished rendering a first frame for test";
|
||||||
}
|
}
|
||||||
#ifdef __linux__
|
//#ifdef __linux__
|
||||||
}
|
}
|
||||||
#endif
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << "Found glcontext not ready, postpone the init";
|
||||||
|
}
|
||||||
|
//#endif
|
||||||
if (is_editor())
|
if (is_editor())
|
||||||
mainframe->select_tab(size_t(0));
|
mainframe->select_tab(size_t(0));
|
||||||
mainframe->Thaw();
|
mainframe->Thaw();
|
||||||
|
|
Loading…
Reference in New Issue