diff --git a/CMakeLists.txt b/CMakeLists.txt index 43a9a64e13a7993bb202549e1a61f78925df53a7..66761796d2fb8aa9636cdb54c8782eccc200fab4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ cmake_minimum_required( VERSION 3.1 FATAL_ERROR ) # visimpl project and version -project( visimpl VERSION 1.1.1 ) +project( visimpl VERSION 1.1.2 ) set( visimpl_VERSION_ABI 6 ) SET( VISIMPL_LICENSE "GPL") diff --git a/visimpl/MainWindow.cpp b/visimpl/MainWindow.cpp index 224b884ade91f411a379eb81bdb25eebb1e35f4b..43da83b324f8ecad5b6162d0854cd626d560ea25 100644 --- a/visimpl/MainWindow.cpp +++ b/visimpl/MainWindow.cpp @@ -1667,16 +1667,38 @@ namespace visimpl { if(!uri_.empty()) { - _zeqUri = uri_; - _zeqConnection = true; - _subscriber = new zeroeq::Subscriber( _zeqUri ); + bool failed = false; + try + { + _zeqUri = uri_; + _zeqConnection = true; + _subscriber = new zeroeq::Subscriber( _zeqUri ); + + _subscriber->subscribe(lexis::data::SelectedIDs::ZEROBUF_TYPE_IDENTIFIER( ), + [&]( const void* data_, unsigned long long size_ ) + { _onSelectionEvent( lexis::data::SelectedIDs::create( data_, size_ ));}); - _subscriber->subscribe(lexis::data::SelectedIDs::ZEROBUF_TYPE_IDENTIFIER( ), - [&]( const void* data_, unsigned long long size_ ) - { _onSelectionEvent( lexis::data::SelectedIDs::create( data_, size_ ));}); + _thread = new std::thread( [this]( ) + { while ( _zeqConnection ) _subscriber->receive( 10000 ); } ); + } + catch(std::exception &e) + { + std::cerr << e.what() << std::endl << " " << __FILE__ << ":" << __LINE__ << std::endl; + failed = true; + } + catch(...) + { + std::cerr << "Unknown exception catched when initializing ZeroEQ. " << __FILE__ << ":" << __LINE__ << std::endl; + failed = true; + } - _thread = new std::thread( [this]( ) - { while ( _zeqConnection ) _subscriber->receive( 10000 ); } ); + if(failed) + { + _zeqUri.clear(); + _zeqConnection = false; + _subscriber = nullptr; + _thread = nullptr; + } } } diff --git a/visimpl/OpenGLWidget.cpp b/visimpl/OpenGLWidget.cpp index 5589f65be85d822837de25385e2ea2b8d99b3fe9..6d93e0255700db8483f19764b41144db71099992 100644 --- a/visimpl/OpenGLWidget.cpp +++ b/visimpl/OpenGLWidget.cpp @@ -173,10 +173,32 @@ namespace visimpl { #ifdef VISIMPL_USE_ZEROEQ if ( !_zeqUri.empty( ) ) - _camera = new Camera( _zeqUri ); - else + { + bool failed = false; + try + { + _camera = new Camera( _zeqUri ); + } + catch(std::exception &e) + { + std::cerr << e.what() << " " << __FILE__ << ":" << __LINE__ << std::endl; + failed = true; + } + catch(...) + { + std::cerr << "Unknown exception catched when initializing camera. " << __FILE__ << ":" << __LINE__ << std::endl; + failed = true; + } + + if(failed) + { + _camera = nullptr; + _zeqUri.clear(); + } + } #endif - _camera = new Camera( ); + + if(!_camera) _camera = new Camera( ); _camera->camera()->farPlane( 100000.f ); @@ -304,7 +326,20 @@ namespace visimpl #ifdef VISIMPL_USE_ZEROEQ if( !_zeqUri.empty( )) - _player->connectZeq( _zeqUri ); + { + try + { + _player->connectZeq( _zeqUri ); + } + catch(std::exception &e) + { + std::cerr << e.what() << std::endl; + } + catch(...) + { + std::cerr << "Unknown exception catched when connecting player. " << __FILE__ << ":" << __LINE__ << std::endl; + } + } #endif this->_paint = true; update( ); @@ -372,7 +407,14 @@ namespace visimpl subsetEventsManager(netData->subsetsEvents()); #ifdef VISIMPL_USE_ZEROEQ - _player->connectZeq( _zeqUri ); + try + { + _player->connectZeq( _zeqUri ); + } + catch(...) + { + + } #endif this->_paint = true; update( ); diff --git a/visimpl/prefr/PrefrShaders.h b/visimpl/prefr/PrefrShaders.h index 45b5a6ce1f50f6dcac2c19b5e770d5d7f5343f36..6203192d106e0ab621269e8d569b0c538b1cc579 100644 --- a/visimpl/prefr/PrefrShaders.h +++ b/visimpl/prefr/PrefrShaders.h @@ -27,7 +27,7 @@ namespace prefr { const static std::string prefrVertexShader = R"( -#version 430 +#version 330 //#extension GL_ARB_separate_shader_objects: enable uniform mat4 modelViewProjM; @@ -63,7 +63,7 @@ void main() )"; const static std::string prefrFragmentShaderDefault = R"( -#version 430 +#version 330 in vec4 color; in vec2 uvCoord; out vec4 outputColor; @@ -118,7 +118,6 @@ out float id; void main() { - vec4 position = vec4((vertexPosition.x * particlePosition.a * cameraRight) + (vertexPosition.y * particlePosition.a * cameraUp) + particlePosition.rgb, 1.0); @@ -169,7 +168,7 @@ void main( ) })"; const static std::string planeVertCode = R"( -#version 430 +#version 330 in vec3 inPos; @@ -190,7 +189,7 @@ void main( ) const static std::string planeFragCode = R"( -#version 430 +#version 330 in vec4 outColor; out vec4 outputColor;