(参考demo/Polyhedron/Scene_polyhedron_item.cpp
注意注释所强调的)
1. 利用opengl渲染cgal的多面体的边
::glBegin(GL_LINES);
Edge_iterator he;
for(he = polyhedron.edges_begin();
he != polyhedron.edges_end();
he++)
{
//注意这里使用的是const Point&
const Point& a = he->vertex()->point();
const Point& b = he->opposite()->vertex()->point();
::glVertex3d(a.x(),a.y(),a.z());
::glVertex3d(b.x(),b.y(),b.z());
}
::glEnd();
2. 利用opengl渲染cgal的多面体的面片
Facet_iterator f;
for(f = polyhedron.facets_begin();
f != polyhedron.facets_end();
f++)

本文介绍如何使用OpenGL来渲染CGAL库中的多面体,包括边的渲染和面片的渲染,详细参考了demo/Polyhedron/Scene_polyhedron_item.cpp文件中的注释。
最低0.47元/天 解锁文章
1523

被折叠的 条评论
为什么被折叠?



