From 8a50397cd9f02577afc15d64e49f149ebcbff751 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 27 Nov 2017 16:21:05 +0100 Subject: [PATCH] Fix Edit_box --- .../demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp | 3 +++ .../Plugins/Point_set/Point_set_selection_plugin.cpp | 3 ++- Polyhedron/demo/Polyhedron/Scene.cpp | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp index 7b743eb31b2..255898a87e1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp @@ -773,6 +773,7 @@ void Scene_edit_box_item::highlight() { d->ready_to_hl = true; Viewer_interface* viewer = dynamic_cast(*QGLViewer::QGLViewerPool().begin()); + viewer->makeCurrent(); int type = -1, id = -1; //pick if(!d->selection_on) @@ -910,6 +911,7 @@ void Scene_edit_box_item::highlight() void Scene_edit_box_item::clearHL() { Viewer_interface* viewer = dynamic_cast(*QGLViewer::QGLViewerPool().begin()); + viewer->makeCurrent(); d->hl_normal.clear(); d->hl_vertex.clear(); @@ -1275,6 +1277,7 @@ double Scene_edit_box_item_priv::applyZ(int id, double z, double dirz) //type : 0 = vertex, 1 = edge, 2 = face void Scene_edit_box_item_priv::picking(int& type, int& id, Viewer_interface *viewer) { + viewer->makeCurrent(); type = -1; id = -1; int deviceWidth = viewer->camera()->screenWidth(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp index d737b6c180a..f42b0d05e58 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp @@ -997,13 +997,14 @@ public Q_SLOTS: { if(toggle) { + QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin(); + qobject_cast(viewer)->set2DSelectionMode(false); edit_box = new Scene_edit_box_item(scene); edit_box->setRenderingMode(Wireframe); edit_box->setName("Selection Box"); connect(edit_box, &Scene_edit_box_item::aboutToBeDestroyed, this, &Polyhedron_demo_point_set_selection_plugin::reset_editbox); scene->addItem(edit_box); - QGLViewer* viewer = *QGLViewer::QGLViewerPool().begin(); viewer->installEventFilter(edit_box); add_box->setEnabled(true); } diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 27fb9ab3835..350f6d893cc 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -600,7 +600,11 @@ Scene::draw_aux(bool with_names, CGAL::Three::Viewer_interface* viewer) continue; if(!with_names && item_should_be_skipped_in_draw(&item)) continue; - if(item.visible()) + if(item.visible() && + (item.renderingMode() == Flat || + item.renderingMode() ==FlatPlusEdges || + item.renderingMode() == Gouraud) + ) { if(with_names) { viewer->glClearDepth(1.0);