From 53277714bfafb32ab7cd715547de8843fd4175eb Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 16 Jul 2019 10:58:02 +0200 Subject: [PATCH] Fix c3t3_item --- Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp | 9 +++++---- .../demo/Polyhedron/Scene_item_rendering_helper.cpp | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp index 7834bca3dd6..426edfa5ef6 100644 --- a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp @@ -137,13 +137,15 @@ public : { if(is_fast) return; + if(!alphaSlider) { alphaSlider = new QSlider(::Qt::Horizontal); alphaSlider->setMinimum(0); alphaSlider->setMaximum(255); alphaSlider->setValue(255); - } + } + viewer->makeCurrent(); const EPICK::Plane_3& plane = qobject_cast(this->parent())->plane(); float shrink_factor = qobject_cast(this->parent())->getShrinkFactor(); QVector4D cp(-plane.a(), -plane.b(), -plane.c(), -plane.d()); @@ -1605,10 +1607,10 @@ void Scene_c3t3_item::show_spheres(bool b) d->spheres->setRenderingMode(Gouraud); connect(d->spheres, SIGNAL(destroyed()), this, SLOT(reset_spheres())); connect(d->spheres, SIGNAL(on_color_changed()), this, SLOT(on_spheres_color_changed())); + d->computeSpheres(); + lockChild(d->spheres); scene->addItem(d->spheres); scene->changeGroup(d->spheres, this); - lockChild(d->spheres); - d->computeSpheres(); } else if (!b && d->spheres!=NULL) { @@ -1644,7 +1646,6 @@ void Scene_c3t3_item::show_intersection(bool b) Scene_c3t3_item* ncthis = const_cast(this); ncthis->d->computeIntersections(viewer); d->are_intersection_buffers_filled[viewer] = true; - ncthis->show_intersection(true); } } scene->addItem(d->intersection); diff --git a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp b/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp index 082a79ce521..5413cd0616f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp @@ -116,7 +116,7 @@ void Scene_item_rendering_helper::initGL(CGAL::Three::Viewer_interface* viewer) if(!pc->isGLInit(viewer)) pc->initGL(viewer); } - if(!isInit(viewer)) + if(!getBuffersFilled()) { Gl_data_names flags; flags = (ALL); @@ -128,6 +128,7 @@ void Scene_item_rendering_helper::initGL(CGAL::Three::Viewer_interface* viewer) void Scene_item_rendering_helper::processData(Gl_data_names )const { computeElements(); + priv->are_buffers_filled = true; }