mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-09 21:10:19 +08:00
Fixed seg fault on start with >= VTK9.1, MACOSX: fixed bundle with homebrew
This commit is contained in:
@@ -24,7 +24,11 @@ IF(WIN32)
|
||||
ELSE( MINGW )
|
||||
SET(SRC_FILES ${SRC_FILES} ${PROJECT_NAME}.rc)
|
||||
ENDIF( MINGW )
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(BUILD_AS_BUNDLE)
|
||||
ADD_DEFINITIONS("-DBUILD_AS_BUNDLE")
|
||||
ENDIF()
|
||||
|
||||
# Add binary
|
||||
IF(APPLE AND BUILD_AS_BUNDLE)
|
||||
@@ -199,9 +203,9 @@ IF(BUILD_AS_BUNDLE AND (APPLE OR WIN32))
|
||||
" COMPONENT runtime)
|
||||
|
||||
# directories to look for dependencies
|
||||
SET(DIRS ${QT_LIBRARY_DIRS} ${PROJECT_SOURCE_DIR}/bin)
|
||||
SET(DIRS ${QT_LIBRARY_DIRS} ${PROJECT_BINARY_DIR}/bin)
|
||||
IF(APPLE)
|
||||
SET(DIRS ${DIRS} /usr/local /usr/local/lib)
|
||||
SET(DIRS ${DIRS} /usr/local /usr/local/lib /opt/homebrew /opt/homebrew/lib /opt/homebrew/lib/gcc/current)
|
||||
ENDIF(APPLE)
|
||||
|
||||
# Now the work of copying dependencies into the bundle/package
|
||||
|
||||
+9
-1
@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <vtkVersionMacros.h>
|
||||
#include <vtkObject.h>
|
||||
|
||||
#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1)
|
||||
#include <QVTKRenderWidget.h>
|
||||
#endif
|
||||
|
||||
using namespace rtabmap;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@@ -51,9 +55,13 @@ int main(int argc, char* argv[])
|
||||
CoInitialize(nullptr);
|
||||
#endif
|
||||
|
||||
#if VTK_MAJOR_VERSION >= 8
|
||||
#if VTK_MAJOR_VERSION >= 8 && defined(BUILD_AS_BUNDLE)
|
||||
vtkObject::GlobalWarningDisplayOff();
|
||||
#endif
|
||||
#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1)
|
||||
// needed to ensure appropriate OpenGL context is created for VTK rendering.
|
||||
QSurfaceFormat::setDefaultFormat(QVTKRenderWidget::defaultFormat());
|
||||
#endif
|
||||
|
||||
/* Create tasks */
|
||||
QApplication * app = new QApplication(argc, argv);
|
||||
|
||||
@@ -82,7 +82,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <vtkOpenGLRenderer.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if VTK_MAJOR_VERSION >= 8
|
||||
#include <vtkGenericOpenGLRenderWindow.h>
|
||||
#endif
|
||||
@@ -140,11 +139,8 @@ CloudViewer::CloudViewer(QWidget *parent, CloudViewerInteractorStyle * style) :
|
||||
_intensityAbsMax(100.0f),
|
||||
_coordinateFrameScale(1.0)
|
||||
{
|
||||
UDEBUG("");
|
||||
this->setMinimumSize(200, 200);
|
||||
|
||||
vtkObject::GlobalWarningDisplayOff();
|
||||
|
||||
int argc = 0;
|
||||
UASSERT(style!=0);
|
||||
style->setCloudViewer(this);
|
||||
@@ -208,12 +204,13 @@ CloudViewer::CloudViewer(QWidget *parent, CloudViewerInteractorStyle * style) :
|
||||
this->SetRenderWindow(_visualizer->getRenderWindow());
|
||||
#endif
|
||||
|
||||
// Replaced by the second line, to avoid a crash in Mac OS X on close, as well as
|
||||
// the "Invalid drawable" warning when the view is not visible.
|
||||
//_visualizer->setupInteractor(this->GetInteractor(), this->GetRenderWindow());
|
||||
// Replaced by the second line, to avoid a crash in Mac OS X on close, as well as
|
||||
// the "Invalid drawable" warning when the view is not visible.
|
||||
#if VTK_MAJOR_VERSION > 8
|
||||
//_visualizer->setupInteractor(this->interactor(), this->renderWindow());
|
||||
this->interactor()->SetInteractorStyle (_visualizer->getInteractorStyle());
|
||||
#else
|
||||
//_visualizer->setupInteractor(this->GetInteractor(), this->GetRenderWindow());
|
||||
this->GetInteractor()->SetInteractorStyle (_visualizer->getInteractorStyle());
|
||||
#endif
|
||||
// setup a simple point picker
|
||||
@@ -1502,11 +1499,11 @@ bool CloudViewer::addTextureMesh (
|
||||
// Save the viewpoint transformation matrix to the global actor map
|
||||
(*_visualizer->getCloudActorMap())[id].viewpoint_transformation_ = transformation;
|
||||
#endif
|
||||
|
||||
|
||||
#if VTK_MAJOR_VERSION >= 7
|
||||
actor->GetProperty()->SetAmbient(0.1);
|
||||
#else
|
||||
actor->GetProperty()->SetAmbient(0.5);
|
||||
actor->GetProperty()->SetAmbient(0.1);
|
||||
#else
|
||||
actor->GetProperty()->SetAmbient(0.5);
|
||||
#endif
|
||||
actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
||||
actor->GetProperty()->SetInterpolation(_aSetFlatShading->isChecked()?VTK_FLAT:VTK_PHONG);
|
||||
|
||||
@@ -32,6 +32,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <vtkObject.h>
|
||||
#include <vtkVersionMacros.h>
|
||||
|
||||
#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1)
|
||||
#include <QVTKRenderWidget.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
ULogger::setType(ULogger::kTypeConsole);
|
||||
@@ -41,8 +45,9 @@ int main(int argc, char * argv[])
|
||||
CoInitialize(nullptr);
|
||||
#endif
|
||||
|
||||
#if VTK_MAJOR_VERSION >= 8
|
||||
vtkObject::GlobalWarningDisplayOff();
|
||||
#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1)
|
||||
// needed to ensure appropriate OpenGL context is created for VTK rendering.
|
||||
QSurfaceFormat::setDefaultFormat(QVTKRenderWidget::defaultFormat());
|
||||
#endif
|
||||
|
||||
QApplication * app = new QApplication(argc, argv);
|
||||
|
||||
Reference in New Issue
Block a user