#include#include#include#include
using namespacestd;const double TWO_PI = 6.2831853;
GLsizei winWidth= 500, winHeight = 500;
GLuint regHex;staticGLfloat rotTheta;classscrPt {public:
GLint x, y;
};voidinit()
{
scrPt hexVertex;
GLdouble hexTheta;
glClearColor(1.0, 1.0, 1.0, 0.0);//创建1个显示列表
regHex = glGenLists(1);//编译显示列表
glNewList(regHex, GL_COMPILE);
glColor3f(209.0 / 255.0, 73.0 / 255.0, 78.0 / 255.0);
glBegin(GL_POLYGON);for (GLint k = 0; k < 6; k++) {
hexTheta= TWO_PI * k / 6;
hexVertex.x= 150 + 100 *cos(hexTheta);
hexVertex.y= 150 + 100 *sin(hexTheta);
glVertex2i(hexVertex.x, hexVertex.y);
}
glEnd();
glEndList();
}voiddisplayHex()
{
glClear(GL_COLOR_BUFFER_BIT);