mirror of https://github.com/CGAL/cgal
Merge branch 'CGAL-Qt5_support-GF'
Fix the corefinement plugins and remove warnings
This commit is contained in:
commit
59b06b3101
|
|
@ -167,7 +167,6 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND Boost_F
|
||||||
add_library(${SCENE_ITEM_LIB} SHARED
|
add_library(${SCENE_ITEM_LIB} SHARED
|
||||||
${DEMO_SRC_DIR}/Scene_item.cpp
|
${DEMO_SRC_DIR}/Scene_item.cpp
|
||||||
Scene_item_moc.cpp
|
Scene_item_moc.cpp
|
||||||
${DEMO_SRC_DIR}/Scene_item_with_display_list.cpp
|
|
||||||
${DEMO_SRC_DIR}/Plugin_helper.cpp)
|
${DEMO_SRC_DIR}/Plugin_helper.cpp)
|
||||||
qt5_use_modules(${SCENE_ITEM_LIB} Xml Script OpenGL Svg)
|
qt5_use_modules(${SCENE_ITEM_LIB} Xml Script OpenGL Svg)
|
||||||
set_target_properties(${SCENE_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_item_EXPORTS)
|
set_target_properties(${SCENE_ITEM_LIB} PROPERTIES DEFINE_SYMBOL scene_item_EXPORTS)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
#include <CGAL/gl.h>
|
#include <CGAL/gl.h>
|
||||||
#include <CGAL/Mesh_3/dihedral_angle_3.h>
|
#include <CGAL/Mesh_3/dihedral_angle_3.h>
|
||||||
|
|
||||||
#include <CGAL_demo/Scene_item_with_display_list.h>
|
|
||||||
#include <CGAL_demo/Scene_interface.h>
|
#include <CGAL_demo/Scene_interface.h>
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include <CGAL/gl.h>
|
#include <CGAL/gl.h>
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,6 @@ Scene_polyhedron_item::Scene_polyhedron_item(const Polyhedron& p)
|
||||||
compile_shaders();
|
compile_shaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scene_polyhedron_item::Scene_polyhedron_item(const Scene_polyhedron_item& item)
|
|
||||||
// : Scene_item_with_display_list(item),
|
|
||||||
// poly(new Polyhedron(*item.poly))
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
|
|
||||||
Scene_polyhedron_item::~Scene_polyhedron_item()
|
Scene_polyhedron_item::~Scene_polyhedron_item()
|
||||||
{
|
{
|
||||||
for(int i=0; i<vboSize; i++)
|
for(int i=0; i<vboSize; i++)
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,6 @@
|
||||||
#include <CGAL_demo/Plugin_helper.h>
|
#include <CGAL_demo/Plugin_helper.h>
|
||||||
#include <ui_Meshing_dialog.h>
|
#include <ui_Meshing_dialog.h>
|
||||||
#include <Scene_polyhedron_item.h>
|
#include <Scene_polyhedron_item.h>
|
||||||
#include <implicit_functions/Implicit_function_interface.h>
|
#include <implicit_functions/Implicit_function_interface.h>*/
|
||||||
#include <CGAL_demo/Scene_item_with_display_list.h>*/
|
|
||||||
|
|
||||||
#endif //STDAFX_H
|
#endif //STDAFX_H
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
#ifndef SCENE_ITEM_WITH_DISPLAY_LIST_H
|
|
||||||
#define SCENE_ITEM_WITH_DISPLAY_LIST_H
|
|
||||||
|
|
||||||
#include <CGAL_demo/Scene_item.h>
|
|
||||||
#include <CGAL/gl.h>
|
|
||||||
#include<QGLViewer/qglviewer.h>
|
|
||||||
|
|
||||||
// This class represents an object in the scene with an OpenGL rendering using display lists
|
|
||||||
class SCENE_ITEM_EXPORT Scene_item_with_display_list
|
|
||||||
: public Scene_item
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Scene_item_with_display_list();
|
|
||||||
// Scene_item_with_display_list(const Scene_item_with_display_list&);
|
|
||||||
~Scene_item_with_display_list();
|
|
||||||
|
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
|
||||||
virtual void direct_draw(QGLViewer*) = 0;
|
|
||||||
virtual void direct_draw_edges(Viewer* viewer) { draw(viewer); }
|
|
||||||
// OpenGL drawing using a display list
|
|
||||||
virtual void draw(Viewer* viewer) ;
|
|
||||||
virtual void draw_edges(Viewer* viewer) ;
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
// Call that once you have finished changing something in the item
|
|
||||||
// (either the properties or internal data).
|
|
||||||
virtual void changed();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
enum { DRAW = 0, DRAW_EDGES = 1, NB_OF_DISPLAY_LISTS = 2};
|
|
||||||
void draw(Viewer* viewer,int) ;
|
|
||||||
// display lists
|
|
||||||
mutable GLuint display_list[NB_OF_DISPLAY_LISTS];
|
|
||||||
mutable bool display_list_built[NB_OF_DISPLAY_LISTS];
|
|
||||||
|
|
||||||
}; // end class Scene_item_with_display_list
|
|
||||||
|
|
||||||
#endif // SCENE_ITEM_WITH_DISPLAY_LIST_H
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
#include <CGAL_demo/Scene_item_with_display_list.h>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
Scene_item_with_display_list::Scene_item_with_display_list()
|
|
||||||
{
|
|
||||||
for(int i = 0; i < NB_OF_DISPLAY_LISTS; ++i) {
|
|
||||||
display_list[i] = 0;
|
|
||||||
display_list_built[i] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scene_item_with_display_list::
|
|
||||||
// Scene_item_with_display_list(const Scene_item_with_display_list& item)
|
|
||||||
// : Scene_item(item),
|
|
||||||
// display_list(0),
|
|
||||||
// display_list_built(false)
|
|
||||||
// {}
|
|
||||||
|
|
||||||
Scene_item_with_display_list::~Scene_item_with_display_list()
|
|
||||||
{
|
|
||||||
for(int i = 0; i < NB_OF_DISPLAY_LISTS; ++i) {
|
|
||||||
if(display_list_built[i] && display_list[i] != 0) {
|
|
||||||
::glDeleteLists(display_list[i],1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Points/Wireframe/Flat/Gouraud OpenGL drawing in a display list
|
|
||||||
|
|
||||||
void Scene_item_with_display_list::draw(Viewer* viewer) {
|
|
||||||
draw(viewer, DRAW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene_item_with_display_list::draw_edges(Viewer* viewer) {
|
|
||||||
draw(viewer, DRAW_EDGES);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene_item_with_display_list::draw(Viewer* viewer, int i)
|
|
||||||
{
|
|
||||||
if(!display_list_built[i])
|
|
||||||
{
|
|
||||||
if(display_list[i] == 0) {
|
|
||||||
display_list[i] = ::glGenLists(1);
|
|
||||||
if(display_list[i] == 0)
|
|
||||||
{
|
|
||||||
std::cerr << "Unable to create display list" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// draw the item in a display list
|
|
||||||
::glNewList(display_list[i],GL_COMPILE_AND_EXECUTE);
|
|
||||||
if(i == 0) {
|
|
||||||
direct_draw(viewer);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
direct_draw_edges(viewer);
|
|
||||||
}
|
|
||||||
::glEndList();
|
|
||||||
display_list_built[i] = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// draw using the display list
|
|
||||||
::glCallList(display_list[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene_item_with_display_list::changed()
|
|
||||||
{
|
|
||||||
for(int i = 0; i < NB_OF_DISPLAY_LISTS; ++i) {
|
|
||||||
display_list_built[i] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -182,9 +182,8 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
||||||
add_item(scene_polygon_soup_item Scene_polygon_soup_item.cpp)# Scene_polygon_soup_item.moc)
|
add_item(scene_polygon_soup_item Scene_polygon_soup_item.cpp)# Scene_polygon_soup_item.moc)
|
||||||
target_link_libraries(scene_polygon_soup_item scene_polyhedron_item)
|
target_link_libraries(scene_polygon_soup_item scene_polyhedron_item)
|
||||||
add_item(scene_nef_polyhedron_item Scene_nef_polyhedron_item.cpp# Scene_nef_polyhedron_item.moc
|
add_item(scene_nef_polyhedron_item Scene_nef_polyhedron_item.cpp)# Scene_nef_polyhedron_item.moc
|
||||||
|
|
||||||
Scene_nef_rendering.cpp)
|
|
||||||
target_link_libraries(scene_nef_polyhedron_item scene_polyhedron_item)
|
target_link_libraries(scene_nef_polyhedron_item scene_polyhedron_item)
|
||||||
add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp)# Scene_points_with_normal_item.moc)
|
add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp)# Scene_points_with_normal_item.moc)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,103 +7,11 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QDebug>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <CGAL/corefinement_operations.h>
|
#include <CGAL/corefinement_operations.h>
|
||||||
void Scene_combinatorial_map_item::initialize_buffers(Viewer_interface *viewer)
|
|
||||||
{
|
|
||||||
viewer->glBindVertexArray(vao);
|
|
||||||
buffer[0] = QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
|
|
||||||
if(!(buffer[0].create()))
|
|
||||||
std::cout<<"ERROR lors de la creation"<<std::endl;
|
|
||||||
buffer[0].bind();
|
|
||||||
buffer[0].setUsagePattern(QOpenGLBuffer::StaticDraw);
|
|
||||||
buffer[0].allocate(positions.data(),
|
|
||||||
static_cast<int>(positions.size()*sizeof(float)));
|
|
||||||
/*
|
|
||||||
viewer->glVertexAttribPointer(0, //number of the buffer
|
|
||||||
4, //number of floats to be taken
|
|
||||||
GL_FLOAT, // type of data
|
|
||||||
GL_FALSE, //not normalized
|
|
||||||
0, //compact data (not in a struct)
|
|
||||||
NULL //no offset (seperated in several buffers)
|
|
||||||
);
|
|
||||||
viewer->glEnableVertexAttribArray(0);*/
|
|
||||||
|
|
||||||
// Clean-up
|
Scene_combinatorial_map_item::Scene_combinatorial_map_item(Scene_interface* scene,void* address):last_known_scene(scene),volume_to_display(0),exportSelectedVolume(NULL),address_of_A(address){m_combinatorial_map=NULL; are_buffers_filled = false;;}
|
||||||
viewer->glBindVertexArray(0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::compile_shaders(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
//fill the vertex shader
|
|
||||||
static const char* vertex_shader_source =
|
|
||||||
{
|
|
||||||
"#version 300 es \n"
|
|
||||||
" \n"
|
|
||||||
"layout (location = 0) in vec3 positions; \n"
|
|
||||||
|
|
||||||
"out highp vec3 fColors; \n"
|
|
||||||
" \n"
|
|
||||||
|
|
||||||
"void main(void) \n"
|
|
||||||
"{ \n"
|
|
||||||
" fColors = vec3(1.0,0.0,0.0); \n"
|
|
||||||
" gl_Position = mvp_matrix * vec4(positions, 1.0); \n"
|
|
||||||
"} \n"
|
|
||||||
};
|
|
||||||
//fill the fragment shader
|
|
||||||
static const char* fragment_shader_source =
|
|
||||||
{
|
|
||||||
"#version 300 es \n"
|
|
||||||
" \n"
|
|
||||||
"in highp vec3 fColors; \n"
|
|
||||||
|
|
||||||
"out highp vec4 color; \n"
|
|
||||||
" \n"
|
|
||||||
"void main(void) \n"
|
|
||||||
"{ \n"
|
|
||||||
" color = vec4(fColors, 1.0); \n"
|
|
||||||
"} \n"
|
|
||||||
};
|
|
||||||
|
|
||||||
QOpenGLShader *vertex_shader = new QOpenGLShader(QOpenGLShader::Vertex);
|
|
||||||
if(!vertex_shader->compileSourceCode(vertex_shader_source))
|
|
||||||
std::cout<<vertex_shader->log().toStdString()<<std::endl;
|
|
||||||
|
|
||||||
QOpenGLShader *fragment_shader = new QOpenGLShader(QOpenGLShader::Fragment);
|
|
||||||
if(!fragment_shader->compileSourceCode(fragment_shader_source))
|
|
||||||
std::cout<<fragment_shader->log().toStdString()<<std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
rendering_program = new QOpenGLShaderProgram();
|
|
||||||
if(!rendering_program->addShader(vertex_shader))
|
|
||||||
std::cout<<rendering_program->log().toStdString()<<std::endl;
|
|
||||||
if(!rendering_program->addShader(fragment_shader))
|
|
||||||
std::cout<<rendering_program->log().toStdString()<<std::endl;
|
|
||||||
rendering_program->link();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::compute_normals_and_vertices(void)
|
|
||||||
{
|
|
||||||
positions.push_back(-1.0);
|
|
||||||
positions.push_back(-1.0);
|
|
||||||
positions.push_back(0.0);
|
|
||||||
|
|
||||||
positions.push_back(0.0);
|
|
||||||
positions.push_back(1.0);
|
|
||||||
positions.push_back(0.0);
|
|
||||||
|
|
||||||
positions.push_back(1.0);
|
|
||||||
positions.push_back(-1.0);
|
|
||||||
positions.push_back(0.0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Scene_combinatorial_map_item::Scene_combinatorial_map_item(Scene_interface* scene,void* address):last_known_scene(scene),volume_to_display(0),exportSelectedVolume(NULL),address_of_A(address){m_combinatorial_map=NULL;}
|
|
||||||
Scene_combinatorial_map_item::~Scene_combinatorial_map_item(){if (m_combinatorial_map!=NULL) delete m_combinatorial_map;}
|
Scene_combinatorial_map_item::~Scene_combinatorial_map_item(){if (m_combinatorial_map!=NULL) delete m_combinatorial_map;}
|
||||||
|
|
||||||
Scene_combinatorial_map_item* Scene_combinatorial_map_item::clone() const{return NULL;}
|
Scene_combinatorial_map_item* Scene_combinatorial_map_item::clone() const{return NULL;}
|
||||||
|
|
@ -140,8 +48,10 @@ Kernel::Vector_3 Scene_combinatorial_map_item::compute_face_normal(Combinatorial
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::set_next_volume(){
|
void Scene_combinatorial_map_item::set_next_volume(){
|
||||||
|
//Update des vectors faits ici
|
||||||
++volume_to_display;
|
++volume_to_display;
|
||||||
volume_to_display=volume_to_display%(combinatorial_map().attributes<3>().size()+1);
|
volume_to_display=volume_to_display%(combinatorial_map().attributes<3>().size()+1);
|
||||||
|
are_buffers_filled = false;
|
||||||
Q_EMIT itemChanged();
|
Q_EMIT itemChanged();
|
||||||
|
|
||||||
if (exportSelectedVolume!=NULL && ( volume_to_display==1 || volume_to_display==0 ) )
|
if (exportSelectedVolume!=NULL && ( volume_to_display==1 || volume_to_display==0 ) )
|
||||||
|
|
@ -315,34 +225,15 @@ bool Scene_combinatorial_map_item::keyPressEvent(QKeyEvent* e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::direct_draw() const {
|
void Scene_combinatorial_map_item::compute_elements(void) const{
|
||||||
#if 0
|
|
||||||
typedef Combinatorial_map_3::One_dart_per_cell_const_range<3> Volume_dart_range;
|
positions_facets.resize(0);
|
||||||
typedef Combinatorial_map_3::One_dart_per_incident_cell_const_range<2,3> Facet_in_volume_drange;
|
normals.resize(0);
|
||||||
typedef Combinatorial_map_3::Dart_of_orbit_const_range<1> Dart_in_facet_range;
|
positions_lines.resize(0);
|
||||||
Volume_dart_range dart_per_volume_range = combinatorial_map().one_dart_per_cell<3>();
|
positions_points.resize(0);
|
||||||
std::cout<<"COUCOU"<<std::endl;
|
|
||||||
std::size_t index = 0;
|
//Facets
|
||||||
for (Volume_dart_range::const_iterator vit=dart_per_volume_range.begin();vit!=dart_per_volume_range.end();++vit)
|
|
||||||
{
|
{
|
||||||
if (++index!=volume_to_display && volume_to_display!=0) continue;
|
|
||||||
Facet_in_volume_drange facet_range=combinatorial_map().one_dart_per_incident_cell<2,3>(vit);
|
|
||||||
|
|
||||||
for(Facet_in_volume_drange::const_iterator fit=facet_range.begin();fit!=facet_range.end();++fit){
|
|
||||||
Dart_in_facet_range vertices=combinatorial_map().darts_of_orbit<1>(fit);
|
|
||||||
Kernel::Vector_3 normal = compute_face_normal(fit);
|
|
||||||
|
|
||||||
::glBegin(GL_POLYGON);
|
|
||||||
::glNormal3d(normal.x(),normal.y(),normal.z());
|
|
||||||
|
|
||||||
for (Dart_in_facet_range::const_iterator pit=vertices.begin();pit!=vertices.end();++pit ){
|
|
||||||
const Kernel::Point_3& p= pit->attribute<0>()->point();
|
|
||||||
::glVertex3d(p.x(),p.y(),p.z());
|
|
||||||
}
|
|
||||||
::glEnd();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::size_t index = 0;
|
std::size_t index = 0;
|
||||||
int voltreated = combinatorial_map().get_new_mark();
|
int voltreated = combinatorial_map().get_new_mark();
|
||||||
int facetreated = combinatorial_map().get_new_mark();
|
int facetreated = combinatorial_map().get_new_mark();
|
||||||
|
|
@ -373,8 +264,12 @@ void Scene_combinatorial_map_item::direct_draw() const {
|
||||||
if ( !combinatorial_map().is_marked(vol_it,facetreated) )
|
if ( !combinatorial_map().is_marked(vol_it,facetreated) )
|
||||||
{
|
{
|
||||||
Kernel::Vector_3 normal = compute_face_normal(vol_it);
|
Kernel::Vector_3 normal = compute_face_normal(vol_it);
|
||||||
::glBegin(GL_POLYGON);
|
for(int i=0; i<3; i++)
|
||||||
::glNormal3d(normal.x(),normal.y(),normal.z());
|
{
|
||||||
|
normals.push_back(normal.x());
|
||||||
|
normals.push_back(normal.y());
|
||||||
|
normals.push_back(normal.z());
|
||||||
|
}
|
||||||
|
|
||||||
//iterate over all darts of facets
|
//iterate over all darts of facets
|
||||||
for ( Combinatorial_map_3::Dart_of_orbit_const_range<1>::const_iterator
|
for ( Combinatorial_map_3::Dart_of_orbit_const_range<1>::const_iterator
|
||||||
|
|
@ -383,11 +278,12 @@ void Scene_combinatorial_map_item::direct_draw() const {
|
||||||
face_it!=face_end; ++face_it)
|
face_it!=face_end; ++face_it)
|
||||||
{
|
{
|
||||||
const Kernel::Point_3& p= face_it->attribute<0>()->point();
|
const Kernel::Point_3& p= face_it->attribute<0>()->point();
|
||||||
::glVertex3d(p.x(),p.y(),p.z());
|
positions_facets.push_back(p.x());
|
||||||
|
positions_facets.push_back(p.y());
|
||||||
|
positions_facets.push_back(p.z());
|
||||||
combinatorial_map().mark(face_it,facetreated);
|
combinatorial_map().mark(face_it,facetreated);
|
||||||
combinatorial_map().mark(face_it, voltreated);
|
combinatorial_map().mark(face_it, voltreated);
|
||||||
}
|
}
|
||||||
::glEnd();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -403,32 +299,102 @@ void Scene_combinatorial_map_item::direct_draw() const {
|
||||||
|
|
||||||
combinatorial_map().free_mark(facetreated);
|
combinatorial_map().free_mark(facetreated);
|
||||||
combinatorial_map().free_mark(voltreated);
|
combinatorial_map().free_mark(voltreated);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::direct_draw_edges() const {
|
//edges
|
||||||
|
{
|
||||||
|
|
||||||
typedef Combinatorial_map_3::One_dart_per_cell_const_range<1> Edge_darts;
|
typedef Combinatorial_map_3::One_dart_per_cell_const_range<1> Edge_darts;
|
||||||
Edge_darts darts=combinatorial_map().one_dart_per_cell<1>();
|
Edge_darts darts=combinatorial_map().one_dart_per_cell<1>();
|
||||||
::glBegin(GL_LINES);
|
|
||||||
for (Edge_darts::const_iterator dit=darts.begin();dit!=darts.end();++dit){
|
for (Edge_darts::const_iterator dit=darts.begin();dit!=darts.end();++dit){
|
||||||
CGAL_assertion(!dit->is_free(1));
|
CGAL_assertion(!dit->is_free(1));
|
||||||
const Kernel::Point_3& a = dit->attribute<0>()->point();
|
const Kernel::Point_3& a = dit->attribute<0>()->point();
|
||||||
const Kernel::Point_3& b = dit->beta(1)->attribute<0>()->point();
|
const Kernel::Point_3& b = dit->beta(1)->attribute<0>()->point();
|
||||||
::glVertex3d(a.x(),a.y(),a.z());
|
positions_lines.push_back(a.x());
|
||||||
::glVertex3d(b.x(),b.y(),b.z());
|
positions_lines.push_back(a.y());
|
||||||
|
positions_lines.push_back(a.z());
|
||||||
|
|
||||||
|
positions_lines.push_back(b.x());
|
||||||
|
positions_lines.push_back(b.y());
|
||||||
|
positions_lines.push_back(b.z());
|
||||||
|
|
||||||
}
|
}
|
||||||
::glEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene_combinatorial_map_item::draw_points() const{
|
//points
|
||||||
|
{
|
||||||
typedef Combinatorial_map_3::Attribute_const_range<0>::type Point_range;
|
typedef Combinatorial_map_3::Attribute_const_range<0>::type Point_range;
|
||||||
const Point_range& points=combinatorial_map().attributes<0>();
|
const Point_range& points=combinatorial_map().attributes<0>();
|
||||||
::glBegin(GL_POINTS);
|
|
||||||
for(Point_range::const_iterator pit=boost::next(points.begin());pit!=points.end();++pit){
|
for(Point_range::const_iterator pit=boost::next(points.begin());pit!=points.end();++pit){
|
||||||
const Kernel::Point_3& p=pit->point();
|
const Kernel::Point_3& p=pit->point();
|
||||||
::glVertex3d(p.x(),p.y(),p.z());
|
positions_points.push_back(p.x());
|
||||||
|
positions_points.push_back(p.y());
|
||||||
|
positions_points.push_back(p.z());
|
||||||
}
|
}
|
||||||
::glEnd();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scene_combinatorial_map_item::initialize_buffers(Viewer_interface *viewer) const
|
||||||
|
{
|
||||||
|
//vao for the edges
|
||||||
|
{
|
||||||
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
|
||||||
|
program->bind();
|
||||||
|
|
||||||
|
vaos[0]->bind();
|
||||||
|
buffers[0].bind();
|
||||||
|
buffers[0].allocate(positions_lines.data(),
|
||||||
|
static_cast<int>(positions_lines.size()*sizeof(double)));
|
||||||
|
program->enableAttributeArray("vertex");
|
||||||
|
program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
|
||||||
|
buffers[0].release();
|
||||||
|
|
||||||
|
vaos[0]->release();
|
||||||
|
program->release();
|
||||||
|
}
|
||||||
|
//vao for the points
|
||||||
|
{
|
||||||
|
program = getShaderProgram(PROGRAM_WITHOUT_LIGHT, viewer);
|
||||||
|
program->bind();
|
||||||
|
|
||||||
|
vaos[1]->bind();
|
||||||
|
buffers[1].bind();
|
||||||
|
buffers[1].allocate(positions_points.data(),
|
||||||
|
static_cast<int>(positions_points.size()*sizeof(double)));
|
||||||
|
program->enableAttributeArray("vertex");
|
||||||
|
program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
|
||||||
|
buffers[1].release();
|
||||||
|
vaos[1]->release();
|
||||||
|
program->release();
|
||||||
|
}
|
||||||
|
//vao for the facets
|
||||||
|
{
|
||||||
|
program = getShaderProgram(PROGRAM_WITH_LIGHT, viewer);
|
||||||
|
program->bind();
|
||||||
|
|
||||||
|
vaos[2]->bind();
|
||||||
|
buffers[2].bind();
|
||||||
|
buffers[2].allocate(positions_facets.data(),
|
||||||
|
static_cast<int>(positions_facets.size()*sizeof(double)));
|
||||||
|
program->enableAttributeArray("vertex");
|
||||||
|
program->setAttributeBuffer("vertex",GL_DOUBLE,0,3);
|
||||||
|
buffers[2].release();
|
||||||
|
|
||||||
|
buffers[3].bind();
|
||||||
|
buffers[3].allocate(normals.data(),
|
||||||
|
static_cast<int>(positions_facets.size()*sizeof(double)));
|
||||||
|
program->enableAttributeArray("normals");
|
||||||
|
program->setAttributeBuffer("normals",GL_DOUBLE,0,3);
|
||||||
|
buffers[3].release();
|
||||||
|
|
||||||
|
vaos[2]->release();
|
||||||
|
program->release();
|
||||||
|
}
|
||||||
|
are_buffers_filled = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scene_combinatorial_map_item::isEmpty() const {return combinatorial_map().number_of_darts()==0;}
|
bool Scene_combinatorial_map_item::isEmpty() const {return combinatorial_map().number_of_darts()==0;}
|
||||||
|
|
@ -491,3 +457,54 @@ QString Scene_combinatorial_map_item::toolTip() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Scene_combinatorial_map_item::draw(Viewer_interface* viewer) const
|
||||||
|
{
|
||||||
|
if(!are_buffers_filled)
|
||||||
|
{
|
||||||
|
compute_elements();
|
||||||
|
initialize_buffers(viewer);
|
||||||
|
}
|
||||||
|
vaos[2]->bind();
|
||||||
|
program=getShaderProgram(PROGRAM_WITH_LIGHT);
|
||||||
|
attrib_buffers(viewer,PROGRAM_WITH_LIGHT);
|
||||||
|
program->bind();
|
||||||
|
program->setAttributeValue("colors", this->color());
|
||||||
|
viewer->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(positions_facets.size()/3));
|
||||||
|
vaos[2]->release();
|
||||||
|
program->release();
|
||||||
|
|
||||||
|
}
|
||||||
|
void Scene_combinatorial_map_item::draw_edges(Viewer_interface* viewer) const
|
||||||
|
{
|
||||||
|
if(!are_buffers_filled)
|
||||||
|
{
|
||||||
|
compute_elements();
|
||||||
|
initialize_buffers(viewer);
|
||||||
|
}
|
||||||
|
vaos[0]->bind();
|
||||||
|
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
|
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
|
program->bind();
|
||||||
|
program->setAttributeValue("colors", this->color());
|
||||||
|
viewer->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(positions_lines.size()/3));
|
||||||
|
vaos[0]->release();
|
||||||
|
program->release();
|
||||||
|
|
||||||
|
}
|
||||||
|
void Scene_combinatorial_map_item::draw_points(Viewer_interface* viewer) const
|
||||||
|
{
|
||||||
|
if(!are_buffers_filled)
|
||||||
|
{
|
||||||
|
compute_elements();
|
||||||
|
initialize_buffers(viewer);
|
||||||
|
}
|
||||||
|
vaos[1]->bind();
|
||||||
|
program=getShaderProgram(PROGRAM_WITHOUT_LIGHT);
|
||||||
|
attrib_buffers(viewer,PROGRAM_WITHOUT_LIGHT);
|
||||||
|
program->bind();
|
||||||
|
program->setAttributeValue("colors", this->color());
|
||||||
|
viewer->glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(positions_points.size()/3));
|
||||||
|
vaos[1]->release();
|
||||||
|
program->release();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@ public:
|
||||||
virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Gouraud && m!=PointsPlusNormals); } // CHECK THIS!
|
virtual bool supportsRenderingMode(RenderingMode m) const { return (m != Gouraud && m!=PointsPlusNormals); } // CHECK THIS!
|
||||||
//Event handling
|
//Event handling
|
||||||
virtual bool keyPressEvent(QKeyEvent*);
|
virtual bool keyPressEvent(QKeyEvent*);
|
||||||
// OpenGL drawing in a display list
|
//drawing of the scene
|
||||||
void direct_draw() const;
|
virtual void draw_edges(Viewer_interface* viewer) const;
|
||||||
void direct_draw_edges() const;
|
virtual void draw_points(Viewer_interface*) const;
|
||||||
void draw_points() const;
|
virtual void draw(Viewer_interface*) const;
|
||||||
|
|
||||||
bool isFinite() const { return true; }
|
bool isFinite() const { return true; }
|
||||||
bool is_from_corefinement() const {return address_of_A!=NULL;}
|
bool is_from_corefinement() const {return address_of_A!=NULL;}
|
||||||
|
|
@ -72,19 +72,18 @@ private:
|
||||||
void* address_of_A;
|
void* address_of_A;
|
||||||
template <class Predicate> void export_as_polyhedron(Predicate,const QString&) const;
|
template <class Predicate> void export_as_polyhedron(Predicate,const QString&) const;
|
||||||
|
|
||||||
std::vector<float> positions;
|
|
||||||
std::vector<float> normals;
|
|
||||||
std::vector<float> color_lines;
|
|
||||||
std::vector<float> color_facets;
|
|
||||||
|
|
||||||
QOpenGLShaderProgram *rendering_program;
|
mutable std::vector<double> positions_lines;
|
||||||
GLint location[9];
|
mutable std::vector<double> positions_points;
|
||||||
|
mutable std::vector<double> positions_facets;
|
||||||
|
mutable std::vector<double> normals;
|
||||||
|
|
||||||
GLuint vao;
|
mutable QOpenGLShaderProgram *program;
|
||||||
QOpenGLBuffer buffer[5];
|
|
||||||
void initialize_buffers(Viewer_interface*);
|
using Scene_item::initialize_buffers;
|
||||||
void compile_shaders(void);
|
void initialize_buffers(Viewer_interface *viewer) const;
|
||||||
void compute_normals_and_vertices(void);
|
|
||||||
|
void compute_elements(void) const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void set_next_volume();
|
void set_next_volume();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QOpenGLFunctions_3_3_Core>
|
|
||||||
#include <QOpenGLBuffer>
|
#include <QOpenGLBuffer>
|
||||||
#include <QOpenGLShader>
|
#include <QOpenGLShader>
|
||||||
#include <QOpenGLVertexArrayObject>
|
#include <QOpenGLVertexArrayObject>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include <CGAL/Inverse_index.h>
|
#include <CGAL/Inverse_index.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "Scene_nef_rendering.h"
|
|
||||||
|
|
||||||
#include <CGAL/minkowski_sum_3.h>
|
#include <CGAL/minkowski_sum_3.h>
|
||||||
#include <CGAL/convex_decomposition_3.h>
|
#include <CGAL/convex_decomposition_3.h>
|
||||||
|
|
@ -453,25 +452,6 @@ Scene_nef_polyhedron_item::toolTip() const
|
||||||
.arg(nef_poly->number_of_volumes());
|
.arg(nef_poly->number_of_volumes());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Scene_nef_polyhedron_item::direct_draw(Viewer_interface* viewer) const {
|
|
||||||
gl_render_nef_facets(nef_poly);
|
|
||||||
|
|
||||||
GLboolean lighting;
|
|
||||||
viewer->glGetBooleanv(GL_LIGHTING, &lighting);
|
|
||||||
viewer->glDisable(GL_LIGHTING);
|
|
||||||
|
|
||||||
GLfloat point_size;
|
|
||||||
viewer->glGetFloatv(GL_POINT_SIZE, &point_size);
|
|
||||||
viewer->glPointSize(10.f);
|
|
||||||
|
|
||||||
gl_render_nef_vertices(nef_poly);
|
|
||||||
|
|
||||||
if(lighting) {
|
|
||||||
viewer->glEnable(GL_LIGHTING);
|
|
||||||
}
|
|
||||||
viewer->glPointSize(point_size);
|
|
||||||
}
|
|
||||||
void Scene_nef_polyhedron_item::draw(Viewer_interface* viewer) const
|
void Scene_nef_polyhedron_item::draw(Viewer_interface* viewer) const
|
||||||
{
|
{
|
||||||
if(!are_buffers_filled)
|
if(!are_buffers_filled)
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ public:
|
||||||
virtual void selection_changed(bool);
|
virtual void selection_changed(bool);
|
||||||
// Indicate if rendering mode is supported
|
// Indicate if rendering mode is supported
|
||||||
virtual bool supportsRenderingMode(RenderingMode m) const { return m != Gouraud; } // CHECK THIS!
|
virtual bool supportsRenderingMode(RenderingMode m) const { return m != Gouraud; } // CHECK THIS!
|
||||||
// OpenGL drawing in a display list
|
|
||||||
void direct_draw(Viewer_interface*) const;
|
|
||||||
|
|
||||||
virtual void draw(Viewer_interface*) const;
|
virtual void draw(Viewer_interface*) const;
|
||||||
virtual void draw_edges() const {}
|
virtual void draw_edges() const {}
|
||||||
|
|
|
||||||
|
|
@ -1,216 +0,0 @@
|
||||||
#include "config.h"
|
|
||||||
#ifdef CGAL_POLYHEDRON_DEMO_USE_NEF
|
|
||||||
#include "Nef_type.h"
|
|
||||||
#include <CGAL/Nef_S2/OGL_base_object.h>
|
|
||||||
#include <CGAL/Nef_3/OGL_helper.h>
|
|
||||||
#include <CGAL/glu.h>
|
|
||||||
|
|
||||||
#include <QList>
|
|
||||||
|
|
||||||
#define GL_MACRO(type) case type: std::cerr << #type; break;
|
|
||||||
|
|
||||||
inline void CGAL_GLU_TESS_CALLBACK beginCallback(GLenum which)
|
|
||||||
{
|
|
||||||
// std::cerr << "glBegin(";
|
|
||||||
// switch(which)
|
|
||||||
// {
|
|
||||||
// GL_MACRO(GL_POINTS);
|
|
||||||
// GL_MACRO(GL_LINES);
|
|
||||||
// GL_MACRO(GL_LINE_STRIP);
|
|
||||||
// GL_MACRO(GL_LINE_LOOP);
|
|
||||||
// GL_MACRO(GL_TRIANGLES);
|
|
||||||
// GL_MACRO(GL_TRIANGLE_STRIP);
|
|
||||||
// GL_MACRO(GL_TRIANGLE_FAN);
|
|
||||||
// GL_MACRO(GL_QUADS);
|
|
||||||
// GL_MACRO(GL_QUAD_STRIP);
|
|
||||||
// GL_MACRO(GL_POLYGON);
|
|
||||||
// }
|
|
||||||
// std::cerr << ")\n";
|
|
||||||
glBegin(which);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void CGAL_GLU_TESS_CALLBACK endCallback(void)
|
|
||||||
{
|
|
||||||
// std::cerr << "glEnd()\n";
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void CGAL_GLU_TESS_CALLBACK errorCallback(GLenum errorCode)
|
|
||||||
{ const GLubyte *estring;
|
|
||||||
estring = gluErrorString(errorCode);
|
|
||||||
fprintf(stderr, "Tessellation Error: %s\n", estring);
|
|
||||||
std::exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void CGAL_GLU_TESS_CALLBACK vertexCallback(GLvoid* vertex,
|
|
||||||
GLvoid* user)
|
|
||||||
{ GLdouble* pc(static_cast<GLdouble*>(vertex));
|
|
||||||
GLdouble* pu(static_cast<GLdouble*>(user));
|
|
||||||
// CGAL_NEF_TRACEN("vertexCallback coord "<<pc[0]<<","<<pc[1]<<","<<pc[2]);
|
|
||||||
// CGAL_NEF_TRACEN("vertexCallback normal "<<pu[0]<<","<<pu[1]<<","<<pu[2]);
|
|
||||||
glNormal3dv(pu);
|
|
||||||
glVertex3dv(pc);
|
|
||||||
// std::cerr << " glNormal("
|
|
||||||
// << pu[0] << ", "
|
|
||||||
// << pu[1] << ", "
|
|
||||||
// << pu[2] << ")\n";
|
|
||||||
// std::cerr << " glVertex("
|
|
||||||
// << pc[0] << ", "
|
|
||||||
// << pc[1] << ", "
|
|
||||||
// << pc[2] << ")\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DPoint {
|
|
||||||
DPoint(GLdouble x, GLdouble y, GLdouble z)
|
|
||||||
{
|
|
||||||
coords[0] = x;
|
|
||||||
coords[1] = y;
|
|
||||||
coords[2] = z;
|
|
||||||
}
|
|
||||||
GLdouble coords[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
void gl_render_nef_facets(Nef_polyhedron *p)
|
|
||||||
{
|
|
||||||
// glPointSize(10);
|
|
||||||
// CGAL_forall_vertices(v, p->sncp())
|
|
||||||
|
|
||||||
|
|
||||||
GLboolean old_light_model;
|
|
||||||
::glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &old_light_model);
|
|
||||||
|
|
||||||
::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
|
||||||
GLUtesselator* tess_ = ::gluNewTess();
|
|
||||||
::gluTessCallback(tess_, GLenum(GLU_TESS_VERTEX_DATA),
|
|
||||||
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &vertexCallback);
|
|
||||||
::gluTessCallback(tess_, GLenum(GLU_TESS_BEGIN),
|
|
||||||
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &beginCallback);
|
|
||||||
::gluTessCallback(tess_, GLenum(GLU_TESS_END),
|
|
||||||
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &endCallback);
|
|
||||||
::gluTessCallback(tess_, GLenum(GLU_TESS_ERROR),
|
|
||||||
(GLvoid (CGAL_GLU_TESS_CALLBACK *)(CGAL_GLU_TESS_DOTS)) &errorCallback);
|
|
||||||
::gluTessProperty(tess_, GLenum(GLU_TESS_WINDING_RULE),
|
|
||||||
GLU_TESS_WINDING_POSITIVE);
|
|
||||||
|
|
||||||
for(Nef_polyhedron::Halffacet_const_iterator
|
|
||||||
f = p->halffacets_begin (),
|
|
||||||
end = p->halffacets_end();
|
|
||||||
f != end; ++f)
|
|
||||||
{
|
|
||||||
if(f->is_twin()) continue;
|
|
||||||
|
|
||||||
Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
|
|
||||||
GLdouble normal[3];
|
|
||||||
normal[0] = CGAL::to_double(v.x());
|
|
||||||
normal[1] = CGAL::to_double(v.y());
|
|
||||||
normal[2] = CGAL::to_double(v.z());
|
|
||||||
GLdouble norm = normal[0]*normal[0]
|
|
||||||
+ normal[1]*normal[1]
|
|
||||||
+ normal[2]*normal[2];
|
|
||||||
norm = CGAL::sqrt(norm);
|
|
||||||
|
|
||||||
normal[0] /= norm;
|
|
||||||
normal[1] /= norm;
|
|
||||||
normal[2] /= norm;
|
|
||||||
|
|
||||||
::gluTessBeginPolygon(tess_, normal);
|
|
||||||
::gluTessNormal(tess_,normal[0],normal[1],normal[2]);
|
|
||||||
|
|
||||||
QList<DPoint> points;
|
|
||||||
for(Nef_polyhedron::Halffacet_cycle_const_iterator
|
|
||||||
fc = f->facet_cycles_begin(),
|
|
||||||
end = f->facet_cycles_end();
|
|
||||||
fc != end; ++fc)
|
|
||||||
{
|
|
||||||
if ( fc.is_shalfedge() )
|
|
||||||
{
|
|
||||||
::gluTessBeginContour(tess_);
|
|
||||||
|
|
||||||
Nef_polyhedron::SHalfedge_const_handle h = fc;
|
|
||||||
Nef_polyhedron::SHalfedge_around_facet_const_circulator hc(h), he(hc);
|
|
||||||
CGAL_For_all(hc,he){ // all vertex coordinates in facet cycle
|
|
||||||
Nef_polyhedron::SVertex_const_handle v = hc->source();
|
|
||||||
const Nef_polyhedron::Point_3& point = v->source()->point();
|
|
||||||
int i = points.size();
|
|
||||||
DPoint dp(CGAL::to_double(point.x()),
|
|
||||||
CGAL::to_double(point.y()),
|
|
||||||
CGAL::to_double(point.z()));
|
|
||||||
points.push_back(dp);
|
|
||||||
|
|
||||||
::gluTessVertex(tess_,
|
|
||||||
static_cast<GLdouble*>(static_cast<void*>(&(points[i].coords))),
|
|
||||||
&(points[i].coords));
|
|
||||||
} // end facet cycles verticeses
|
|
||||||
|
|
||||||
::gluTessEndContour(tess_);
|
|
||||||
}
|
|
||||||
} // end facet cycles
|
|
||||||
::gluTessEndPolygon(tess_);
|
|
||||||
} // end facets
|
|
||||||
::gluDeleteTess(tess_);
|
|
||||||
|
|
||||||
::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, old_light_model);
|
|
||||||
|
|
||||||
GLenum gl_error = ::glGetError();
|
|
||||||
if(gl_error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
std::cerr << "OPENGL ERROR in gl_render_nef_facets!\n "
|
|
||||||
<< ::gluErrorString(gl_error) << "\n";
|
|
||||||
}
|
|
||||||
} // end gl_render_nef_facets
|
|
||||||
|
|
||||||
void gl_render_nef_edges(Nef_polyhedron *p)
|
|
||||||
{
|
|
||||||
::glBegin(GL_LINES);
|
|
||||||
|
|
||||||
for(Nef_polyhedron::Halfedge_const_iterator
|
|
||||||
e = p->halfedges_begin(),
|
|
||||||
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();
|
|
||||||
const Nef_polyhedron::Point_3& b = t->point();
|
|
||||||
::glVertex3d(CGAL::to_double(a.x()),
|
|
||||||
CGAL::to_double(a.y()),
|
|
||||||
CGAL::to_double(a.z()));
|
|
||||||
::glVertex3d(CGAL::to_double(b.x()),
|
|
||||||
CGAL::to_double(b.y()),
|
|
||||||
CGAL::to_double(b.z()));
|
|
||||||
}
|
|
||||||
|
|
||||||
::glEnd();
|
|
||||||
GLenum gl_error = ::glGetError();
|
|
||||||
if(gl_error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
std::cerr << "OPENGL ERROR in gl_render_nef_edges!\n "
|
|
||||||
<< ::gluErrorString(gl_error) << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gl_render_nef_vertices(Nef_polyhedron* p)
|
|
||||||
{
|
|
||||||
::glBegin(GL_POINTS);
|
|
||||||
|
|
||||||
for(Nef_polyhedron::Vertex_const_iterator
|
|
||||||
v = p->vertices_begin(),
|
|
||||||
end = p->vertices_end();
|
|
||||||
v != end; ++v)
|
|
||||||
{
|
|
||||||
const Nef_polyhedron::Point_3& p = v->point();
|
|
||||||
::glVertex3d(CGAL::to_double(p.x()),
|
|
||||||
CGAL::to_double(p.y()),
|
|
||||||
CGAL::to_double(p.z()));
|
|
||||||
}
|
|
||||||
|
|
||||||
::glEnd();
|
|
||||||
GLenum gl_error = ::glGetError();
|
|
||||||
if(gl_error != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
std::cerr << "OPENGL ERROR in gl_render_nef_vertices!\n "
|
|
||||||
<< ::gluErrorString(gl_error) << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // CGAL_POLYHEDRON_DEMO_USE_NEF
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
#include "Nef_type_fwd.h"
|
|
||||||
|
|
||||||
void gl_render_nef_facets(Nef_polyhedron* poly);
|
|
||||||
void gl_render_nef_edges(Nef_polyhedron* poly);
|
|
||||||
void gl_render_nef_vertices(Nef_polyhedron* poly);
|
|
||||||
Loading…
Reference in New Issue