From a2139d1c52ad70c282bc950b51876a0b0ba019e0 Mon Sep 17 00:00:00 2001 From: zhaoyong Date: Tue, 29 Oct 2019 00:06:14 +0800 Subject: [PATCH] fix bug work with orbslam --- CMakeLists.txt | 2 +- GSLAM/plugins/qviz/panels/win3d/Win3D.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b70158ef..74ce9f61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ pi_add_target(gslam_topic SHARED GSLAM/plugins/topic REQUIRED System LTO) pi_add_target(qviz_panel_win3d SHARED GSLAM/plugins/qviz/panels/win3d REQUIRED System Qt OpenGL GLEW) pi_add_target(qviz_panel_displays SHARED GSLAM/plugins/qviz/panels/displays REQUIRED System Qt) -pi_add_target(qviz_panel_frameinfo SHARED GSLAM/plugins/qviz/panels/frameinfo REQUIRED System Qt) +pi_add_target(qviz_panel_frameinfo SHARED GSLAM/plugins/qviz/panels/frameinfo REQUIRED System Qt OpenCV) pi_add_target(qviz_panel_pubsubs SHARED GSLAM/plugins/qviz/panels/pubsubs REQUIRED System Qt) pi_add_target(qviz_panel_logger SHARED GSLAM/plugins/qviz/panels/logger REQUIRED System Qt) diff --git a/GSLAM/plugins/qviz/panels/win3d/Win3D.cpp b/GSLAM/plugins/qviz/panels/win3d/Win3D.cpp index 7f9edc78..710ff74a 100644 --- a/GSLAM/plugins/qviz/panels/win3d/Win3D.cpp +++ b/GSLAM/plugins/qviz/panels/win3d/Win3D.cpp @@ -69,13 +69,13 @@ class VisNodeGL: public QObject{ if(node->colors.size()){ glBindBuffer(GL_ARRAY_BUFFER,_colorBuffer); - glBufferData(GL_ARRAY_BUFFER,node->colors.size()*3*sizeof(NodeGL::Color3b), + glBufferData(GL_ARRAY_BUFFER,node->colors.size()*sizeof(NodeGL::Color3b), node->colors.data(), GL_STATIC_DRAW); } if(node->normals.size()){ glBindBuffer(GL_ARRAY_BUFFER,_normalBuffer); - glBufferData(GL_ARRAY_BUFFER,node->normals.size()*3*sizeof(NodeGL::Vertex3f), + glBufferData(GL_ARRAY_BUFFER,node->normals.size()*sizeof(NodeGL::Vertex3f), node->normals.data(), GL_STATIC_DRAW); } @@ -209,9 +209,11 @@ void Win3D::slotNode(Svar msg) if(node->empty()) { - nodevis.erase(node->name); - messenger.publish("qviz/display",nodevis); - updateGL(); + if(nodevis.exist(node->name)){ + nodevis.erase(node->name); + messenger.publish("qviz/display",nodevis); + updateGL(); + } return; } @@ -274,7 +276,7 @@ void Win3D::updateScenseCenterRadius() if(vis->_transform.get_scale()>0){ std::vector add; for(int i=0;i<8;i++) - add.push_back(Point3f(vertices[i&1].x,vertices[i&2].y,vertices[i&4].z)); + add.push_back(Point3f(vertices[i&1].x,vertices[(i&2)>>1].y,vertices[(i&4)>>2].z)); vertices=add; }