定义面
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
gluQuadricDrawStyle(Cylinder,GL_FILL);
GL_FRONT表示显示模式将适用于物体的前向面(也就是物体能看到的面)
GL_BACK表示显示模式将适用于物体的后向面(也就是物体上不能看到的面)
GL_FRONT_AND_BACK表示显示模式将适用于物体的所有面
GL_POINT表示显示顶点,多边形用点显示
GL_LINE表示显示线段,多边形用轮廓显示
GL_FILL表示显示面,多边形采用填充形式
glBegin(GL_LINES); //绘制线
glBegin(GL_QUADS) //绘制四边形
glBegin(GL_TRIANGLES); //绘制三角形
矩阵
矩阵要写在绘制内容前面
glPushMatrix();
Mat4x4f mMat = Transposit(matrix);
glMultMatrixf(&mMat[0][0]);
glPopMatrix();
绘制球体
gluSphere (GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks);
//gluSphere (Sphere, 半径, GLint slices, GLint stacks);
绘制圆柱
gluCylinder (GLUquadric *qobj, GLdouble bottomRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks);
//gluCylinder(Cylinder, 底半径, 顶半径,高,GLint slices, GLint stacks);
绘制圆锥
gluCylinder (GLUquadric *qobj, GLdouble bottomRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks);
//gluCylinder(Cylinder, 底半径, 0,高,GLint slices, GLint stacks);
绘制立方体
绘制6个面
point1 2 3 4 point5 6 7 8 point2376 point 3487 point 1485 point 1265
绘制圆