Remove native gl.h include and native gl code in Surface_mesher/archive

This commit is contained in:
Maxime Gimeno 2018-02-28 08:59:59 +01:00
parent 4f95e55427
commit 2156017402
7 changed files with 1 additions and 371 deletions

View File

@ -1,103 +0,0 @@
// Copyright (c) 2008 INRIA 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
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// 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$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Camille Wormser, Pierre Alliez
#ifndef CGAL_AABB_DRAWING_TRAITS_H
#define CGAL_AABB_DRAWING_TRAITS_H
#include <CGAL/license/AABB_tree.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/gl.h>
#include <vector>
namespace CGAL {
template<typename Primitive, typename Node>
struct AABB_drawing_traits
{
std::vector<float> *v_edges;
double offset[3];
typedef CGAL::Bbox_3 Bbox;
bool go_further() { return true; }
bool intersection(const int&, const Primitive&)
{
return true;
}
bool do_intersect(const int&, // unused
const Node& node)
{
gl_draw(node.bbox());
return true;
}
// draw bbox
void gl_draw(const Bbox& bb)
{
gl_draw_edge(bb.xmin(), bb.ymin(), bb.zmin(),
bb.xmax(), bb.ymin(), bb.zmin());
gl_draw_edge(bb.xmin(), bb.ymin(), bb.zmin(),
bb.xmin(), bb.ymax(), bb.zmin());
gl_draw_edge(bb.xmin(), bb.ymin(), bb.zmin(),
bb.xmin(), bb.ymin(), bb.zmax());
gl_draw_edge(bb.xmax(), bb.ymin(), bb.zmin(),
bb.xmax(), bb.ymax(), bb.zmin());
gl_draw_edge(bb.xmax(), bb.ymin(), bb.zmin(),
bb.xmax(), bb.ymin(), bb.zmax());
gl_draw_edge(bb.xmin(), bb.ymax(), bb.zmin(),
bb.xmax(), bb.ymax(), bb.zmin());
gl_draw_edge(bb.xmin(), bb.ymax(), bb.zmin(),
bb.xmin(), bb.ymax(), bb.zmax());
gl_draw_edge(bb.xmin(), bb.ymin(), bb.zmax(),
bb.xmax(), bb.ymin(), bb.zmax());
gl_draw_edge(bb.xmin(), bb.ymin(), bb.zmax(),
bb.xmin(), bb.ymax(), bb.zmax());
gl_draw_edge(bb.xmax(), bb.ymax(), bb.zmax(),
bb.xmin(), bb.ymax(), bb.zmax());
gl_draw_edge(bb.xmax(), bb.ymax(), bb.zmax(),
bb.xmax(), bb.ymin(), bb.zmax());
gl_draw_edge(bb.xmax(), bb.ymax(), bb.zmax(),
bb.xmax(), bb.ymax(), bb.zmin());
}
void gl_draw_edge(double px, double py, double pz,
double qx, double qy, double qz)
{
v_edges->push_back((float)px+offset[0]);
v_edges->push_back((float)py+offset[1]);
v_edges->push_back((float)pz+offset[2]);
v_edges->push_back((float)qx+offset[0]);
v_edges->push_back((float)qy+offset[1]);
v_edges->push_back((float)qz+offset[2]);
}
}; // AABB_drawing_traits
} // end namespace CGAL
#endif // CGAL_AABB_DRAWING_TRAITS_H

View File

@ -32,7 +32,7 @@
#include <CGAL/Qt/debug.h>
#include <QDir>
#include <iostream>
#include <CGAL/gl.h>
#include <QtOpenGL/qgl.h>
#include <qopenglfunctions.h>
namespace CGAL {
namespace Qt {

View File

@ -172,7 +172,6 @@
#include <CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h>
#include <CGAL/Filtered_predicate.h>
#include <CGAL/function_objects.h>
#include <CGAL/gl.h>
#include <CGAL/Hilbert_policy_tags.h>
#include <CGAL/hilbert_sort.h>
#include <CGAL/Hilbert_sort_2.h>

View File

@ -31,14 +31,12 @@
#include <algorithm>
#include <vector>
# include <CGAL/gl.h>
/// The Point_set_3 class is array of points + normals of type
/// Point_with_normal_3<Gt> (in fact
/// UI_point_3 to support a selection flag and an optional radius).
/// It provides:
/// - accessors: points and normals iterators, property maps
/// - OpenGL rendering
/// - bounding box
///
/// CAUTION:

View File

@ -26,7 +26,6 @@
#ifndef CGAL_OPENGL_TOOLS_H
#define CGAL_OPENGL_TOOLS_H
# include <CGAL/gl.h>
#include <CGAL/Three/Viewer_interface.h>
namespace CGAL {

View File

@ -35,8 +35,6 @@
#include <CGAL/HalfedgeDS_default.h>
#include <list>
#include <CGAL/gl.h>
// a refined facet with a normal and a tag
template <class Refs, class T, class P, class Norm>
class Enriched_facet : public CGAL::HalfedgeDS_face_base<Refs, T>
@ -492,99 +490,6 @@ public :
center = CGAL::ORIGIN + (vec/FT(degree));
}
void gl_draw_direct_triangles(bool smooth_shading,
bool use_normals,
bool inverse_normals = false)
{
// draw triangles
::glBegin(GL_TRIANGLES);
Facet_iterator pFacet = facets_begin();
for(;pFacet != facets_end();pFacet++)
gl_draw_facet(pFacet,smooth_shading,use_normals,inverse_normals);
::glEnd(); // end polygon assembly
}
void gl_draw_direct(bool smooth_shading,
bool use_normals,
bool inverse_normals = false)
{
// draw polygons
Facet_iterator pFacet = facets_begin();
for(;pFacet != facets_end();pFacet++)
{
// begin polygon assembly
::glBegin(GL_POLYGON);
gl_draw_facet(pFacet,smooth_shading,use_normals,inverse_normals);
::glEnd(); // end polygon assembly
}
}
void gl_draw_facet(Facet_handle pFacet,
bool smooth_shading,
bool use_normals,
bool inverse_normals = false)
{
// one normal per face
if(use_normals && !smooth_shading)
{
const typename Facet::Normal_3& normal = pFacet->normal();
if(inverse_normals)
::glNormal3f(-normal[0],-normal[1],-normal[2]);
else
::glNormal3f(normal[0],normal[1],normal[2]);
}
// revolve around current face to get vertices
Halfedge_around_facet_circulator pHalfedge = pFacet->facet_begin();
do
{
// one normal per vertex
if(use_normals && smooth_shading)
{
const typename Facet::Normal_3& normal = pHalfedge->vertex()->normal();
if(inverse_normals)
::glNormal3f(-normal[0],-normal[1],-normal[2]);
else
::glNormal3f(normal[0],normal[1],normal[2]); }
// polygon assembly is performed per vertex
const Point& point = pHalfedge->vertex()->point();
::glVertex3d(point[0],point[1],point[2]);
}
while(++pHalfedge != pFacet->facet_begin());
}
// superimpose edges
void superimpose_edges(bool skip_ordinary_edges = true,
bool skip_control_edges = false)
{
::glBegin(GL_LINES);
for(Edge_iterator h = edges_begin();
h != edges_end();
h++)
{
if(h->sharp())
continue;
// ignore this edges
if(skip_ordinary_edges && !h->control_edge())
continue;
// ignore control edges
if(skip_control_edges && h->control_edge())
continue;
// assembly and draw line segment
const Point& p1 = h->prev()->vertex()->point();
const Point& p2 = h->vertex()->point();
::glVertex3f(p1[0],p1[1],p1[2]);
::glVertex3f(p2[0],p2[1],p2[2]);
}
::glEnd();
}
bool is_sharp(Halfedge_handle he,
const double angle_sharp)
{
@ -761,87 +666,6 @@ public :
return nb;
}
// draw edges
void gl_draw_sharp_edges(const float line_width,
unsigned char r,
unsigned char g,
unsigned char b)
{
::glLineWidth(line_width);
::glColor3ub(r,g,b);
::glBegin(GL_LINES);
for(Halfedge_iterator he = edges_begin();
he != edges_end();
he++)
{
if(he->sharp())
{
const Point& a = he->opposite()->vertex()->point();
const Point& b = he->vertex()->point();
::glVertex3d(a[0],a[1],a[2]);
::glVertex3d(b[0],b[1],b[2]);
}
}
::glEnd();
}
void gl_draw_boundaries()
{
::glBegin(GL_LINES);
for(Halfedge_iterator he = halfedges_begin();
he != halfedges_end();
he++)
{
if(he->is_border())
{
const Point& a = he->vertex()->point();
const Point& b = he->opposite()->vertex()->point();
::glVertex3d(a.x(),a.y(),a.z());
::glVertex3d(b.x(),b.y(),b.z());
}
}
::glEnd();
}
// draw bounding box
void gl_draw_bounding_box()
{
::glBegin(GL_LINES);
// along x axis
::glVertex3f(m_bbox.xmin(),m_bbox.ymin(),m_bbox.zmin());
::glVertex3f(m_bbox.xmax(),m_bbox.ymin(),m_bbox.zmin());
::glVertex3f(m_bbox.xmin(),m_bbox.ymin(),m_bbox.zmax());
::glVertex3f(m_bbox.xmax(),m_bbox.ymin(),m_bbox.zmax());
::glVertex3f(m_bbox.xmin(),m_bbox.ymax(),m_bbox.zmin());
::glVertex3f(m_bbox.xmax(),m_bbox.ymax(),m_bbox.zmin());
::glVertex3f(m_bbox.xmin(),m_bbox.ymax(),m_bbox.zmax());
::glVertex3f(m_bbox.xmax(),m_bbox.ymax(),m_bbox.zmax());
// along y axis
::glVertex3f(m_bbox.xmin(),m_bbox.ymin(),m_bbox.zmin());
::glVertex3f(m_bbox.xmin(),m_bbox.ymax(),m_bbox.zmin());
::glVertex3f(m_bbox.xmin(),m_bbox.ymin(),m_bbox.zmax());
::glVertex3f(m_bbox.xmin(),m_bbox.ymax(),m_bbox.zmax());
::glVertex3f(m_bbox.xmax(),m_bbox.ymin(),m_bbox.zmin());
::glVertex3f(m_bbox.xmax(),m_bbox.ymax(),m_bbox.zmin());
::glVertex3f(m_bbox.xmax(),m_bbox.ymin(),m_bbox.zmax());
::glVertex3f(m_bbox.xmax(),m_bbox.ymax(),m_bbox.zmax());
// along z axis
::glVertex3f(m_bbox.xmin(),m_bbox.ymin(),m_bbox.zmin());
::glVertex3f(m_bbox.xmin(),m_bbox.ymin(),m_bbox.zmax());
::glVertex3f(m_bbox.xmin(),m_bbox.ymax(),m_bbox.zmin());
::glVertex3f(m_bbox.xmin(),m_bbox.ymax(),m_bbox.zmax());
::glVertex3f(m_bbox.xmax(),m_bbox.ymin(),m_bbox.zmin());
::glVertex3f(m_bbox.xmax(),m_bbox.ymin(),m_bbox.zmax());
::glVertex3f(m_bbox.xmax(),m_bbox.ymax(),m_bbox.zmin());
::glVertex3f(m_bbox.xmax(),m_bbox.ymax(),m_bbox.zmax());
::glEnd();
}
// count #boundaries
unsigned int nb_boundaries()

View File

@ -366,93 +366,6 @@ void Polyhedral_surface::draw(bool with_names)
else
std::cerr << "Call list (" << list_id << ")failed.\n";
}
if(surface_ptr)
{
if(display_surface)
{
// enable polygon offset
::glEnable(GL_POLYGON_OFFSET_FILL);
::glPolygonOffset(1.0f,1.0f);
::glEnable(GL_LIGHTING);
::glColor3f(0.2f, 0.2f, 1.f);
if(with_names)
surface_ptr->gl_draw_direct_triangles_with_name(false,
true,
inverse_normals());
else
surface_ptr->gl_draw_almost_all_triangles(selected_facet,
false,
true,
inverse_normals());
if(!with_names && selected_facet >= 0)
{
::glColor3f(1., 1.f, 0.f);
surface_ptr->incidence_graph.gl_draw_facet(selected_facet,
false,
true,
inverse_normals());
}
::glDisable(GL_LIGHTING);
::glLineWidth(1.0f);
if(display_all_edges)
{
// superimpose ordinary edges
::glColor3d(0.,0.,.8);
surface_ptr->superimpose_edges(false,display_control_edges);
}
// superimpose control edges
if(display_control_edges)
{
::glDisable(GL_LIGHTING);
::glColor3d(.0, .0, .0);
::glLineWidth(1.0f);
surface_ptr->superimpose_edges(true,false);
}
// draw sharp edges
::glColor3ub(128,128,128);
if(with_names)
surface_ptr->gl_draw_sharp_edges_with_names(3.0f,255,0,0);
else
surface_ptr->gl_draw_sharp_edges(3.0f,255,0,0);
if(!with_names && selected_edge >= 0)
{
::glLineWidth(3.0f);
::glColor3d(0., 1., 0.);
surface_ptr->incidence_graph.gl_draw_edge(selected_edge);
}
} // end if display_surface
if(!with_names && (display_octree||display_edges_octree) )
{
::glColor3ub(0,0,0);
::glLineWidth(1.0f);
::glDisable(GL_LIGHTING);
::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
::glEnable(GL_LINE_STIPPLE);
if(display_octree)
{
::glColor3ub(0,0,0);
surface_ptr->gl_draw_facet_octree();
}
if(display_edges_octree)
{
::glColor3d(1.,0.,0.);
surface_ptr->gl_draw_edges_octree();
}
::glDisable(GL_LINE_STIPPLE);
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
::glEnable(GL_LIGHTING);
} // end if display_octree
::glDisable(GL_POLYGON_OFFSET_FILL);
if(!with_names && is_dirty)
{
::glEndList();
is_dirty = false;
}
} // end if(surface_ptr)
}
void Polyhedral_surface::get_bbox(float& xmin, float& ymin, float& zmin,
float& xmax, float& ymax, float& zmax)