manual import of patches from feature branch Mesh_3-experiments-GF

|------------------------------------------------------------------------
  |r66673 | lrineau | 2011-12-06 15:40:22 +0100 (Tue, 06 Dec 2011) | 1 line
  |
  |Fix the "Erase all" action
  |------------------------------------------------------------------------

  |------------------------------------------------------------------------
  |r66512 | lrineau | 2011-11-24 15:33:59 +0100 (Thu, 24 Nov 2011) | 5 lines
  |
  |Do not use GL_COMPILE_AND_EXECUTE with display lists
  |
  |If we call glNewList with GL_COMPILE_AND_EXECUTE, then any glGetError()
  |inside triggers an GL_INVALID_OPERATION error. Now one uses GL_COMPILE and
  |then call the list just after its creation.
  |------------------------------------------------------------------------

  |------------------------------------------------------------------------
  |r64472 | sloriot | 2011-06-29 14:28:00 +0200 (Wed, 29 Jun 2011) | 3 lines
  |
  |draw only one out of the two opposite halfedges in nef
  |
  |
  |------------------------------------------------------------------------
  |------------------------------------------------------------------------
  |r67665 | lrineau | 2012-02-08 16:12:11 +0100 (Wed, 08 Feb 2012) | 1 line
  |
  |Display the selected vertex's point, if the polyhedron selection
  |------------------------------------------------------------------------

  |------------------------------------------------------------------------
  |r64570 | lrineau | 2011-07-04 16:04:28 +0200 (Mon, 04 Jul 2011) | 5 lines
  |
  |The Show Point dialog is pre-filled with the clipboard.
  |
  |If the content of the clipboard (either the selection clipboard or the
  |normal clipboard) matches, the line edit of the Show Point dialog is
  |pre-filled with that content.
  |-----------------------------------------------------------------------

  |------------------------------------------------------------------------
  |r66511 | lrineau | 2011-11-24 15:33:57 +0100 (Thu, 24 Nov 2011) | 5 lines
  |
  |Fix an OpenGL bug
  |
  |"::glDisable(GL_POLYGON_SMOOTH_HINT)" is not right. That gives an
  |GL_INVALID_ENUM error. One must use "glHint(GL_LINE_SMOOTH_HINT,
  |GL_FASTEST)" instead.
  |------------------------------------------------------------------------

  |------------------------------------------------------------------------
  |r66510 | lrineau | 2011-11-24 15:33:55 +0100 (Thu, 24 Nov 2011) | 4 lines
  |
  |New file with a function CGAL::check_gl_error(filename, line_nb)
  |
  |That function checks if the OpenGL stack has errors, and display them. It
  |uses GLU to get error strings for error enums (gluErrorString).
  |------------------------------------------------------------------------
This commit is contained in:
Sébastien Loriot 2012-08-22 15:36:50 +00:00
parent 6b602e456f
commit c6df9cdc85
9 changed files with 76 additions and 6 deletions

View File

@ -112,6 +112,9 @@ Scene::erase(QList<int> 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())

View File

@ -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 {

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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));
}

View File

@ -1,6 +1,8 @@
#include "Show_point_dialog.h"
#include "ui_Show_point_dialog.h"
#include <QClipboard>
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&)));
}

View File

@ -1,4 +1,6 @@
#include "Viewer.h"
#include <CGAL/gl.h>
#include <CGAL/check_gl_error.h>
#include "Scene_draw_interface.h"
#include <QMouseEvent>
#include <QKeyEvent>
@ -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()

View File

@ -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 <iostream>
#include <CGAL/glu.h>
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