Skip to Content.
Sympa Menu

cgal-discuss - Render a Polyhedron_3 using OpenGL vertex arrays

Subject: CGAL users discussion list

List archive

Render a Polyhedron_3 using OpenGL vertex arrays


Chronological Thread 
  • From:
  • To:
  • Subject: Render a Polyhedron_3 using OpenGL vertex arrays
  • Date: Wed, 7 Nov 2007 02:36:23 +0100

Dear all,

I would like to render a Polyhedron_3 mesh with +100K vertices in interactive
FPS using OpenGL.

(1) If the mesh is static, there is not problem:
- I can use a display list, build vertex arrays or use VBO (looping on the
Vertex_iterator, Facet_iterator). This is not my case.

(2) If the mesh geometry is dynamic (but the connectivity is static)
- It is possible to build a vertex array or VBO each time the geometry is
modified. However, I wouldn't like to loop on the iterators to build the new
opengl vertex array every time because is not efficient. I would like to pass
the pointer to the mesh geometry directly to OpenGL. I would like something
similar to (mesh is a pointer to a Polyhedron_3 object):

###############################
typedef Polyhedron_3::Point_iterator Point_iterator;
Point_iterator pi = mesh->points_begin();

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(SOMESTRIDEVALUE), &(*pi)[0]);
glDrawElements(GL_TRIANGLES, 3*mesh->nfaces(), GL_UNSIGNED_INT, &faces[0]);
###############################

..... It is possible to do this? how to determine the STRIDE value?


(3) If the geometry and the connectivity is dynamic
- This is not my case

Thanks in advance,

Alvaro Cuno
COPPE-UFRJ



Archive powered by MHonArc 2.6.16.

Top of Page