旋转运动opengl c ++

时间:2014-10-30 08:44:23

标签: c++ opengl

我正在尝试使用OpenGL制作风车。我想让风扇的叶片旋转。我怎样才能使它发挥作用。

以下是我到目前为止的粉丝部分

void MyFan::drawWings()
{
GLboolean cullingIsOn;
glGetBooleanv(GL_CULL_FACE, &cullingIsOn);
glDisable(GL_CULL_FACE);
GLboolean normalizeIsOn;
glGetBooleanv(GL_NORMALIZE, &normalizeIsOn);
glEnable(GL_NORMALIZE);
glColor3f(5.5f, 3.0f, 5.5f);
glPushMatrix();
glBegin(GL_TRIANGLES);
glNormal3f( 1.0f, 0.0f, 2.0f);
glVertex3f( 0.0f, 0.0f, 0.0f);
glVertex3f( 0.0f, 4.0f, 0.0f);
glVertex3f(-2.0f, 4.0f, 1.0f);
glNormal3f( 0.0f, 1.0f, 2.0f);
glVertex3f( 0.0f, 0.0f, 0.0f);
glVertex3f(-4.0f, 0.0f, 0.0f);
glVertex3f(-4.0f,-2.0f, 1.0f);
glNormal3f(-1.0f, 0.0f, 2.0f);
glVertex3f( 0.0f, 0.0f, 0.0f);
glVertex3f( 0.0f,-4.0f, 0.0f);
glVertex3f( 2.0f,-4.0f, 1.0f);
glNormal3f( 0.0f,-1.0f, 2.0f);
glVertex3f( 0.0f, 0.0f, 0.0f);
glVertex3f( 4.0f, 0.0f, 0.0f);
glVertex3f( 4.0f, 2.0f, 1.0f);
glEnd();
glPopMatrix();
if (cullingIsOn==GL_TRUE) glEnable(GL_CULL_FACE);
if (normalizeIsOn==GL_TRUE) glEnable(GL_NORMALIZE);
}
void MyFan::tickTime(long int elapseTime) //elapsetime in milisec
{
};

0 个答案:

没有答案