diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 8169c09e2c7..a56c0379d50 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -112,6 +112,9 @@ Scene::erase(QList indices) QAbstractListModel::reset(); int index = max_index + 1 - indices.size(); + if(index >= m_entries.size()) { + index = m_entries.size() - 1; + } if(index >= 0) return index; if(!m_entries.isEmpty()) diff --git a/Polyhedron/demo/Polyhedron/Scene_item_with_display_list.cpp b/Polyhedron/demo/Polyhedron/Scene_item_with_display_list.cpp index f77c1574962..e8fbe7b9634 100644 --- a/Polyhedron/demo/Polyhedron/Scene_item_with_display_list.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_item_with_display_list.cpp @@ -48,7 +48,7 @@ void Scene_item_with_display_list::draw(int i) const } } // draw the item in a display list - ::glNewList(display_list[i],GL_COMPILE_AND_EXECUTE); + ::glNewList(display_list[i],GL_COMPILE); if(i == 0) { direct_draw(); } @@ -56,6 +56,7 @@ void Scene_item_with_display_list::draw(int i) const direct_draw_edges(); } ::glEndList(); + ::glCallList(display_list[i]); display_list_built[i] = true; } else { diff --git a/Polyhedron/demo/Polyhedron/Scene_nef_rendering.cpp b/Polyhedron/demo/Polyhedron/Scene_nef_rendering.cpp index 987b0562897..fb0eef97656 100644 --- a/Polyhedron/demo/Polyhedron/Scene_nef_rendering.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_nef_rendering.cpp @@ -168,6 +168,7 @@ void gl_render_nef_edges(Nef_polyhedron *p) end = p->halfedges_end(); e != end; ++e) { + if (e->is_twin()) continue; const Nef_polyhedron::Vertex_const_handle& s = e->source(); const Nef_polyhedron::Vertex_const_handle& t = e->twin()->source(); const Nef_polyhedron::Point_3& a = s->point(); diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h index 920fba0ce37..648056d1e3f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h @@ -10,7 +10,7 @@ struct Polygon_soup; class Scene_polyhedron_item; -class SCENE_POLYGON_SOUP_EXPORT Scene_polygon_soup_item +class SCENE_POLYGON_SOUP_ITEM_EXPORT Scene_polygon_soup_item : public Scene_item_with_display_list { Q_OBJECT diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item_config.h b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item_config.h index 6b8ce16ff7b..8d9ad15ad4f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item_config.h +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item_config.h @@ -2,9 +2,9 @@ #define SCENE_POLYGON_SOUP_ITEM_CONFIG_H #ifdef scene_polygon_soup_item_EXPORTS -# define SCENE_POLYGON_SOUP_EXPORT Q_DECL_EXPORT +# define SCENE_POLYGON_SOUP_ITEM_EXPORT Q_DECL_EXPORT #else -# define SCENE_POLYGON_SOUP_EXPORT Q_DECL_IMPORT +# define SCENE_POLYGON_SOUP_ITEM_EXPORT Q_DECL_IMPORT #endif #endif // SCENE_POLYGON_SOUP_ITEM_CONFIG_H diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp index 7009db4a32f..f40c83388b4 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_item.cpp @@ -377,6 +377,7 @@ Scene_polyhedron_item::select(double orig_x, nearest_v = v; } } + std::cerr << "Selected vertex: " << v->point() << std::endl; emit selected_vertex((void*)(&*nearest_v)); } diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp b/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp index c0802a85457..8d4812cea12 100644 --- a/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp +++ b/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp @@ -1,6 +1,8 @@ #include "Show_point_dialog.h" #include "ui_Show_point_dialog.h" +#include + Show_point_dialog::Show_point_dialog(QWidget* parent) : QDialog(parent) , ui(new Ui::Show_point_dialog) @@ -8,6 +10,22 @@ Show_point_dialog::Show_point_dialog(QWidget* parent) { ui->setupUi(this); + QClipboard::Mode mode = QClipboard::Selection; + while(true) { + QString clipboard_text = QApplication::clipboard()->text(mode); + + interprete_string(clipboard_text); + if(m_has_correct_coordinates) { + ui->lineEdit->setText(clipboard_text); + ui->lineEdit->selectAll(); + break; + } else { + interprete_string(ui->lineEdit->text()); + } + if(mode == QClipboard::Selection) mode = QClipboard::Clipboard; + else break; + } + connect(ui->lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(interprete_string(const QString&))); } diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 7e388703e7f..ec36d1965b0 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -1,4 +1,6 @@ #include "Viewer.h" +#include +#include #include "Scene_draw_interface.h" #include #include @@ -168,14 +170,14 @@ void Viewer_impl::draw_aux(bool with_names) { ::glDisable(GL_BLEND); ::glDisable(GL_LINE_SMOOTH); - ::glDisable(GL_POLYGON_SMOOTH_HINT); - ::glBlendFunc(GL_ONE, GL_ZERO); ::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); + ::glBlendFunc(GL_ONE, GL_ZERO); } if(with_names) scene->drawWithNames(); else scene->draw(); + CGAL::check_gl_error(__FILE__, __LINE__); } void Viewer::drawWithNames() diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/check_gl_error.h b/Polyhedron/demo/Polyhedron/include/CGAL/check_gl_error.h new file mode 100644 index 00000000000..baf05b45e1c --- /dev/null +++ b/Polyhedron/demo/Polyhedron/include/CGAL/check_gl_error.h @@ -0,0 +1,44 @@ +// Copyright (c) 2011 GeometryFactory, Sophia Antipolis (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/next/Installation/include/CGAL/gl.h $ +// $Id: gl.h 45375 2008-09-08 11:40:39Z spion $ +// +// Author: Laurent Rineau + +#ifndef CGAL_GL_CHECK_ERROR_H +#define CGAL_GL_CHECK_ERROR_H + +#include +#include + +namespace CGAL { + +inline void check_gl_error(const char* filename, long line) +{ + GLenum error = glGetError(); + if(error != GL_NO_ERROR) { + std::cerr << "GL errors! file " << filename << ", line:" << line << "\n"; + do { + std::cerr << gluErrorString(error) << std::endl; + error = glGetError(); + } + while(error != GL_NO_ERROR); + std::cerr << "end of errors\n"; + } +} + +} // end namespace CGAL + +#endif // CGAL_GL_CHECK_ERROR_H