glu中提供了一个绘制圆柱体的函数:
void gluCylinder( GLUquadric* quad,
GLdouble base,
GLdouble top,
GLdouble height,
GLint slices,
GLint stacks )
使用方法是:
GLUquadric *pObj;
pObj = gluNewQuadric();
调用gluCylinder函数时,将pObj作为第一个参数传入。
gluDeleteQuadric(pObj);
这样子绘制出的圆柱体是空心的:

我根据gluCylinder函数写了个函数,将两边封顶。
最终绘制出的圆柱体:

本文介绍如何使用OpenGL中的gluCylinder函数绘制一个实心圆柱体,并详细展示了通过自定义函数实现圆柱顶部和底部封闭的具体过程。
3209

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



