Subject: CGAL users discussion list
List archive
- From: Kye Wong <>
- To:
- Subject: Re: [cgal-discuss] On rendering of Polyhedron in CGAL 3.3
- Date: Mon, 27 Sep 2010 13:05:40 +0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ZaJJTYpV2xa8P1xDudqpkjbD260Gf5qt1fQ21f5M53CWzGleVC7yo2q+pbWTRvEO1O B26V6KhWIwMpSxm804lJsM42xSp1SXNM0ETQMyYkSkh4TwLJfk3Jmmpq6r85sCPahtqP gMfrS5IWAAid8fWzv4IWAkH9NOq9bHANiEERw=
Hi all,
Thank you very much for your kindly instructions.
In fact, I can update my question like this:
How to render a Polyhedron_3 using opengl vertex arrays
I google it and have found the following existing topics:
https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2007-11/msg00028.html
and Alvaro has uploaded his solution:
https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2007-12/msg00053.html
I'm wondering if there are any more convenient methods for solving this problem, if both the geometry and topology of the mesh are not static?
Thanks very much!
Regards,
Wang Kai
On Sun, Sep 26, 2010 at 11:04 PM, Pierre Alliez <> wrote:
dear Kyewong,
if your mesh is static you should clearly use VBOs (vertex buffer objects) - this can be at least 10 times faster.
in a first preprocessing step you can create the VBOs - something like
glGenBuffers(...);
// for each VBO...
float *pData = new float[...];
// fill data here
// load data to the graphics card
glBindBuffer(GL_ARRAY_BUFFER, ...);
glBufferData(GL_ARRAY_BUFFER, size, pData, GL_STATIC_DRAW);
delete [] pData;
then in the rendering loop call something like
for(i=0;i<nb_vbos;i++)
{
::glEnableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER, ... vbo ids);
glVertexPointer(3, GL_FLOAT, 0, 0); // adjust to triangle mesh
glDrawArrays(GL_POINTS, begin, count);
::glDisableClientState(GL_VERTEX_ARRAY);
}
we let you check a tutorial on VBOs.
Pierre
Pierre Alliez
INRIA Sophia Antipolis - Mediterranee
Project-team GEOMETRICA
http://www-sop.inria.fr/members/Pierre.Alliez/
Tel: +33 4 92 38 76 77
Fax: +33 4 97 15 53 95
Le 26/09/2010 17:42, kyewong a écrit :
Hi all
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
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();
}
}
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
--
Kye Wong
- [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.