Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Polyhedron rending with OpenGL

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Polyhedron rending with OpenGL


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Polyhedron rending with OpenGL
  • Date: Wed, 6 Jun 2018 10:15:54 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:jJyWnBTwYxou27NaSgAZgRSmftpsv+yvbD5Q0YIujvd0So/mwa6yYxSN2/xhgRfzUJnB7Loc0qyK6/2mATRIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfbN/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbDVwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4KB3RRLmiioKOSc1/H3Yh8dtiK5WoA6tqxl5zoXJYo+aKeB+c7vAc90ES2pPXsVfWSJPDYyzbYQAE+UPMP1Er4T/vVYCsQeyCAeuCe7p1zRGhmX23ao/0+k5Hw3IwRIvEMkUv3TPsNX1NbkdUeaox6fOyjXDdfJW2TDh6IPVdhwvoO+DXbV1ccXP1UkvDQPEgFWKpoP5IzOV0f4Nsmie4+ZuSOmijHUnqwV2oji1x8csjZXJipgQylDA7ih5z4M1Kse5SE5/e9KrDJxQtySDOoZwX8gsTWZouCMgxb0Hv562ZC4Kx448yBHEb/yIbZKE7Q7kVOaUJzpzmXFreKqnihuw/kWs0PDwWte03VpQrSdJjMPAu38O2hDL6MWKSeFx8lmu1DuOzQzf9+VJLE4umafZK5MsxKM7mIAJvkTZBCD2nV37jK+IeUUg/eil8+Hnba/npp+YLoN1hAT+Prg3lsyxDuk1MRICX2ec+eS7273j+VP2TK9Wgf0xl6nVqJHaJcIFqa6lGwJY0Iku5wyiAzu40NkUh3oKIExfdB+IjIXlI1TOL+r5Dfe7jVSsijBrx/XeM736BpXNKWLDkLbmfbZh8UJczQ4zwMtQ55JREL4BIfbzVlXtu9zfCx81Kxa0zPr/CNVhyoMeXnqCDbOWMKzItV+E//8gI+iXZIAJpTb9MOMl6uX1jX45nF8dZbOm0YEWaHC+BPRmIl+WbWDigtcbQi82uV81Q+XuzVGDSjVOfG2aXqQm5zh9Bpj1I53EQ9Xnu7GL1TynH5BQLkRBEFGLDT+oWIiDXvoQcjO8K8R9lSYVFPLpH5Ql0guvsxO8zr5PIe/d+ylevpXmgosmr9bPnA0/oGQnR/+W1HuAGjwsxzJad3oNxKl65HdF5BKG2Kl8jeZfEIUKtfxMWwY+c5Xbyr4jUoygakf6Zt6MDW2ebJC+GzhoF4A+xtYPZwB2HNDw1kmejRrvOKcckvmwPLJx8q/Y2CKsdcN0ynKDy6x5yld6Eo1AMmqpgqM5/A/WVdbE

I don't see any error here.
Try posting a minimal complete example showing the error
so that we can reproduce it. Maybe the error is not where
you think it is and selected parts are not relevant.

Sebastien

On 06/06/2018 10:02 AM, Lettuce wrote:
Hello,
firstly i use CGAL::poisson_suface_reconstruction_delaunay to creat a mesh
here is the code

CGAL::poisson_surface_reconstruction_delaunay
(points.begin(), points.end(),
CGAL::First_of_pair_property_map<Pwn>(),
CGAL::Second_of_pair_property_map<Pwn>(),
P, average_spacing);

then i want to use opengl to rending it and the code is

void gl_draw_facet(Polyhedron::Facet_iterator f){
Polyhedron::Halfedge_around_facet_circulator he = f->facet_begin();
do{
const Point& p = he->vertex()->point();
glVertex3d(p.x(), p.y(), p.z());
} while (++he != f->facet_begin());
}

void drawPoint(){
Polyhedron::Vertex_iterator v;
Polyhedron::Facet_iterator f;
Polyhedron::Edge_iterator eit;
Polyhedron::Halfedge_handle h_handle;
double x, y, z;

CGAL::Polygon_mesh_processing::compute_normals(P,
boost::make_assoc_property_map(vnormals),
boost::make_assoc_property_map(fnormals));

glBegin(GL_TRIANGLES);
for (f = P.facets_begin(); f != P.facets_end(); f++){
xx = fnormals[f].x() /
sqrt((fnormals[f].x()*fnormals[f].x()) +
(fnormals[f].y()*fnormals[f].y()) + (fnormals[f].z()*fnormals[f].z()));
yy = fnormals[f].y() /
sqrt((fnormals[f].x()*fnormals[f].x()) +
(fnormals[f].y()*fnormals[f].y()) + (fnormals[f].z()*fnormals[f].z()));
zz = fnormals[f].z() /
sqrt((fnormals[f].x()*fnormals[f].x()) +
(fnormals[f].y()*fnormals[f].y()) + (fnormals[f].z()*fnormals[f].z()));
glNormal3f(xx, yy, zz);
gl_draw_facet(f);
}
glEnd();
}
but the result shows there is something wrong with the normals. here is the
result
<http://cgal-discuss.949826.n4.nabble.com/file/t375948/cat.png>

i dont know what's wrong with my code.

need help,thank you.





--
Sent from: http://cgal-discuss.949826.n4.nabble.com/




Archive powered by MHonArc 2.6.18.

Top of Page