Merge pull request #2884 from maxGimeno/CGAL-Remove_gl_h-GF

Remove remaining native GL code
This commit is contained in:
Laurent Rineau 2018-03-06 16:22:34 +01:00
commit 34c8857c9e
7 changed files with 1 additions and 283 deletions

View File

@ -26,7 +26,6 @@
#include <CGAL/Bbox_3.h>
#include <CGAL/gl.h>
#include <vector>
namespace CGAL {

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,26 +26,11 @@
#ifndef CGAL_OPENGL_TOOLS_H
#define CGAL_OPENGL_TOOLS_H
# include <CGAL/gl.h>
#include <CGAL/Three/Viewer_interface.h>
namespace CGAL {
namespace GL {
class Color {
GLfloat c[4];
public:
Color() {
::glGetFloatv(GL_CURRENT_COLOR, &c[0]);
}
~Color() {
set_rgb_color(c[0], c[1], c[2], c[3]);
}
void set_rgb_color(GLfloat r, GLfloat g, GLfloat b, GLfloat a = 1.f) {
::glColor4f(r, g, b, a);
}
}; // end class Color;
class Point_size {
GLfloat ps;
CGAL::Three::Viewer_interface* viewer;

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)