Subject: CGAL users discussion list
List archive
[cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation
Chronological Thread
- From: Sidnei Basei <>
- To:
- Subject: [cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation
- Date: Thu, 14 Mar 2013 16:39:48 -0300
Hi All,
I'm trying to find a way to build vertex and index matrix after Alpha_Shape_3 triangulation.
I want use OpenGL VBO buffer. For example, I need something like following:
GLfloat vertices[][3] = {
{ -1.0, -1.0, -1.0 },
{ 1.0, -1.0, -1.0 },
{ 1.0, 1.0, -1.0 },
{ -1.0, 1.0, -1.0 },
{ -1.0, -1.0, 1.0 },
{ 1.0, -1.0, 1.0 },
{ 1.0, 1.0, 1.0 },
{ -1.0, 1.0, 1.0 }
};
GLubyte indices[][4] = {
{ 0, 1, 2, 3 },
{ 4, 7, 6, 5 },
{ 0, 4, 5, 1 },
{ 3, 2, 6, 7 },
{ 0, 3, 7, 4 },
{ 1, 5, 6, 2 }
};
I want use it in OpenGL, like this:
glGenBuffers(NUM_BUFFERS, buffers);
glBindBuffer(GL_ARRAY_BUFFER, buffers[VERTICES]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glEnableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[INDICES]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
glDrawElements(GL_QUADS, 24, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0));
My current Alpha_Shape_3 is:
Alpha_shape_3::Alpha_shape_facets_iterator ffi=as.Alpha_shape_facets_begin();
for( ; ffi!=as.Alpha_shape_facets_end();ffi++) {
Triangle tr = as.triangle(*ffi);
I DON'T WANT TRIANGLE VERTICES COORDINATES. I WANT vertices MATRIZ and INDICES.
out->push_back(tr);
}
Any idea?
Thank you a lot.
--
Sidnei Basei
- [cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation, Sidnei Basei, 03/14/2013
- Re: [cgal-discuss] Getting Vertex and Index matrix from Alpha_Shape_3 triangulation, Sebastien Loriot (GeometryFactory), 03/15/2013
Archive powered by MHonArc 2.6.18.