Subject: CGAL users discussion list
List archive
- From: Joachim Reichel <>
- To:
- Subject: Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3
- Date: Sun, 26 Sep 2010 12:36:42 +0200
Hi,
> I've found a problem when rendering Polyhedron in opengl environment:
> When the number of vertices of the mesh rendered is big, then it'll be very
what is "big"? 10000? 100000? 1 million?
> slow when manipulating it (translate, rotation or scale) in the window,
> wheras i've found that the manipulation in other software(eg. meshlab) for
> the same mesh is much faster.
> Has anyone else found the same problem?
> I attached my code of rendering as follows, could anyone give me some
> suggestions on speeding it up pls?
>
> void render(Polyhedron * pmesh)
> {
> for ( Facet_iterator i = pmesh->facets_begin(); i != pmesh->facets_end();
> i++)
> {
> glBegin(GL_POLYGON);
> Halfedge_around_facet_circulator j = i->facet_begin();
> do
> {
> glNormal3f(j->vertex()->normal().x(),
> j->vertex()->normal().y(),
> j->vertex()->normal().z());
>
> glVertex3f(j->vertex()->point().x(),
> j->vertex()->point().y(),
> j->vertex()->point().z());
> } while(++j != i->facet_begin());
> glEnd();
> }
> }
it might help if you bind repeated expressions like j->vertex()->normal() to a
const reference.
But I guess you get the most benefit by using OpenGL display lists and/or
vertex arrays. See http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=12
and http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=45 for examples.
Joachim
- [cgal-discuss] On rendering of Polyhedron in CGAL 3.3, kyewong, 09/26/2010
- Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3, Joachim Reichel, 09/26/2010
- Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3, Laurent Rineau (GeometryFactory), 09/26/2010
- Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3, Bo Zhou, 09/26/2010
- <Possible follow-up(s)>
- Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3, Pierre Alliez, 09/26/2010
- Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3, Kye Wong, 09/27/2010
Archive powered by MHonArc 2.6.16.