@@ -945,29 +945,52 @@ int F3DStarter::Start(int argc, char** argv)
945
945
bool offscreen = !this ->Internals ->AppOptions .Reference .empty () ||
946
946
!this ->Internals ->AppOptions .Output .empty () || this ->Internals ->AppOptions .BindingsList ;
947
947
948
- if ( this -> Internals -> AppOptions . RenderingBackend == " egl " )
948
+ try
949
949
{
950
- this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createEGL ());
950
+ if (this ->Internals ->AppOptions .RenderingBackend == " egl" )
951
+ {
952
+ this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createEGL ());
953
+ }
954
+ else if (this ->Internals ->AppOptions .RenderingBackend == " osmesa" )
955
+ {
956
+ this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createOSMesa ());
957
+ }
958
+ else if (this ->Internals ->AppOptions .RenderingBackend == " glx" )
959
+ {
960
+ this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createGLX (offscreen));
961
+ }
962
+ else if (this ->Internals ->AppOptions .RenderingBackend == " wgl" )
963
+ {
964
+ this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createWGL (offscreen));
965
+ }
966
+ else
967
+ {
968
+ if (this ->Internals ->AppOptions .RenderingBackend != " auto" )
969
+ {
970
+ f3d::log::warn (" --rendering-backend value is invalid, falling back to \" auto\" " );
971
+ }
972
+ this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::create (offscreen));
973
+ }
951
974
}
952
- else if ( this -> Internals -> AppOptions . RenderingBackend == " osmesa " )
975
+ catch ( const f3d::context::loading_exception& ex )
953
976
{
954
- this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createOSMesa ());
977
+ f3d::log::error (" Could not load graphic library: " , ex.what ());
978
+ return EXIT_FAILURE;
955
979
}
956
- else if ( this -> Internals -> AppOptions . RenderingBackend == " glx " )
980
+ catch ( const f3d::context::symbol_exception& ex )
957
981
{
958
- this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createGLX (offscreen));
982
+ f3d::log::error (" Could not find needed symbol in graphic library: " , ex.what ());
983
+ return EXIT_FAILURE;
959
984
}
960
- else if ( this -> Internals -> AppOptions . RenderingBackend == " wgl " )
985
+ catch ( const f3d::engine::no_window_exception& ex )
961
986
{
962
- this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::createWGL (offscreen));
987
+ f3d::log::error (" Could not create the window: " , ex.what ());
988
+ return EXIT_FAILURE;
963
989
}
964
- else
990
+ catch ( const f3d::engine::cache_exception& ex)
965
991
{
966
- if (this ->Internals ->AppOptions .RenderingBackend != " auto" )
967
- {
968
- f3d::log::warn (" --rendering-backend value is invalid, falling back to \" auto\" " );
969
- }
970
- this ->Internals ->Engine = std::make_unique<f3d::engine>(f3d::engine::create (offscreen));
992
+ f3d::log::error (" Could not use default cache directory: " , ex.what ());
993
+ return EXIT_FAILURE;
971
994
}
972
995
973
996
this ->ResetWindowName ();
0 commit comments