::gl error fix and CGALColor warning fix

This commit is contained in:
Maxime Gimeno 2015-09-08 15:53:38 +02:00
parent ea54208be1
commit cd5312a5ad
7 changed files with 30 additions and 37 deletions

View File

@ -102,8 +102,8 @@ public:
void draw_edges(Viewer_interface* viewer) const { void draw_edges(Viewer_interface* viewer) const {
for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) { for(Polyline_data_list::const_iterator it = polyline_data_list.begin(); it != polyline_data_list.end(); ++it) {
if(it == active_hole) { ::glLineWidth(7.f); } if(it == active_hole) { viewer->glLineWidth(7.f); }
else { ::glLineWidth(3.f); } else { viewer->glLineWidth(3.f); }
if(selected_holes.find(it) != selected_holes.end()) if(selected_holes.find(it) != selected_holes.end())
{ it->polyline->setRbgColor(255, 0, 0); } { it->polyline->setRbgColor(255, 0, 0); }

View File

@ -74,7 +74,7 @@ public:
} }
void draw_edges(Viewer_interface* viewer) const { void draw_edges(Viewer_interface* viewer) const {
::glLineWidth(3.f); viewer->glLineWidth(3.f);
polyline->setRbgColor(0, 255, 0); polyline->setRbgColor(0, 255, 0);
polyline->draw_edges(viewer); polyline->draw_edges(viewer);

View File

@ -20,12 +20,6 @@
#include <QAbstractProxyModel> #include <QAbstractProxyModel>
namespace {
void CGALglcolor(QColor c)
{
::glColor4d(c.red()/255.0, c.green()/255.0, c.blue()/255.0, c.alpha()/255.0);
}
}
GlSplat::SplatRenderer* Scene::ms_splatting = 0; GlSplat::SplatRenderer* Scene::ms_splatting = 0;

View File

@ -76,7 +76,7 @@ public:
} }
void draw() const { void draw() const {
::glBegin(GL_TRIANGLES); /* ::glBegin(GL_TRIANGLES);
for(C2t3::Facet_iterator for(C2t3::Facet_iterator
fit = c2t3().facets_begin(), fit = c2t3().facets_begin(),
end = c2t3().facets_end(); end = c2t3().facets_end();
@ -89,7 +89,7 @@ public:
const Tr::Geom_traits::Point_3& pc = cell->vertex((index+3)&3)->point(); const Tr::Geom_traits::Point_3& pc = cell->vertex((index+3)&3)->point();
draw_triangle(pa, pb, pc); draw_triangle(pa, pb, pc);
} }
::glEnd(); ::glEnd();*/
} }
private: private:

View File

@ -506,7 +506,7 @@ compute_function_grid() const
typedef K::Point_3 Point_3; typedef K::Point_3 Point_3;
// Get transformation // Get transformation
const ::GLdouble* m = frame_->matrix(); const GLdouble* m = frame_->matrix();
// OpenGL matrices are row-major matrices // OpenGL matrices are row-major matrices
Aff_transformation t (m[0], m[4], m[8], m[12], Aff_transformation t (m[0], m[4], m[8], m[12],

View File

@ -167,7 +167,6 @@ void Scene_points_with_normal_item::compute_normals_and_vertices(void)
// Draw *selected* points // Draw *selected* points
if (m_points->nb_selected_points() > 0) if (m_points->nb_selected_points() > 0)
{ {
::glPointSize(4.f); // selected => bigger
for (Point_set_3<Kernel>::const_iterator it = m_points->begin(); it != m_points->end(); it++) for (Point_set_3<Kernel>::const_iterator it = m_points->begin(); it != m_points->end(); it++)
{ {
const UI_point& p = *it; const UI_point& p = *it;
@ -381,19 +380,19 @@ bool Scene_points_with_normal_item::supportsRenderingMode(RenderingMode m) const
( m==PointsPlusNormals || m==Splatting ) ); ( m==PointsPlusNormals || m==Splatting ) );
} }
void Scene_points_with_normal_item::draw_splats(Viewer_interface*) const void Scene_points_with_normal_item::draw_splats(Viewer_interface* viewer) const
{ {
// TODO add support for selection // TODO add support for selection
::glBegin(GL_POINTS); viewer->glBegin(GL_POINTS);
for ( Point_set_3<Kernel>::const_iterator it = m_points->begin(); it != m_points->end(); it++) for ( Point_set_3<Kernel>::const_iterator it = m_points->begin(); it != m_points->end(); it++)
{ {
const UI_point& p = *it; const UI_point& p = *it;
::glNormal3dv(&p.normal().x()); viewer->glNormal3dv(&p.normal().x());
::glMultiTexCoord1d(GL_TEXTURE2, p.radius()); viewer->glMultiTexCoord1d(GL_TEXTURE2, p.radius());
::glVertex3dv(&p.x()); viewer->glVertex3dv(&p.x());
} }
::glEnd(); viewer->glEnd();

View File

@ -190,39 +190,39 @@ void Viewer_impl::draw_aux(bool with_names, Viewer* viewer)
if(scene == 0) if(scene == 0)
return; return;
::glLineWidth(1.0f); viewer->glLineWidth(1.0f);
::glPointSize(2.f); viewer->glPointSize(2.f);
::glEnable(GL_POLYGON_OFFSET_FILL); viewer->glEnable(GL_POLYGON_OFFSET_FILL);
::glPolygonOffset(1.0f,1.0f); viewer->glPolygonOffset(1.0f,1.0f);
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
::glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); viewer->glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
if(twosides) if(twosides)
::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
else else
::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE); viewer->glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
if(antialiasing) if(antialiasing)
{ {
::glEnable(GL_BLEND); viewer->glEnable(GL_BLEND);
::glEnable(GL_LINE_SMOOTH); viewer->glEnable(GL_LINE_SMOOTH);
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); viewer->glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); viewer->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
else else
{ {
::glDisable(GL_BLEND); viewer->glDisable(GL_BLEND);
::glDisable(GL_LINE_SMOOTH); viewer->glDisable(GL_LINE_SMOOTH);
::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); viewer->glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
::glBlendFunc(GL_ONE, GL_ZERO); viewer->glBlendFunc(GL_ONE, GL_ZERO);
} }
if(with_names) if(with_names)
scene->drawWithNames(viewer); scene->drawWithNames(viewer);
else else
scene->draw(viewer); scene->draw(viewer);
::glDisable(GL_POLYGON_OFFSET_FILL); viewer->glDisable(GL_POLYGON_OFFSET_FILL);
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); viewer->glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
} }
void Viewer::drawWithNames() void Viewer::drawWithNames()