【发布时间】:2012-01-04 23:44:48
【问题描述】:
我做了一个运动场,它会旋转 180 度。 不幸的是,您看不到它变得越来越慢。 我只看到了最后的“转折”。
/**
@brief Rotates the Gamefield 180° with an turn animaion
*/
void flipGamefield180degree (){
for (int i = 0; i < 180; i++){
glRotatef(1, 0, 1, 0);
glutPostRedisplay();
Sleep(20);
}
}
void display(void)
{
// Löscht den Bildschirm
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Zeichenfarbe setzen
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity ();
// _,_,_ wo steht die Kamera, _,_,_ wo hin, wo ist oben?
gluLookAt (0.0, 0.0, 10, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
// Rotation X-Achse
rotating(0);
// Rotation Y-Achse
rotating(1);
// Rotation Z-Achse
rotating(2);
if (flip180degree){
flipGamefield180degree();
}
/*glRotatef(15,0,1,0);
glRotatef(-15,1,0,0);
*/
glTranslatef(-5.5, -6 ,0);
glPushMatrix();
drawGameField(false, 10);
glPopMatrix();
glPushMatrix();
glTranslatef(11, 0 ,0);
glPushMatrix();
drawGameField(true, 10);
glPopMatrix();
glPopMatrix();
//drawShipOnField(s1, feldSpieler);
drawShipOnField(s1, feldSpieler);
//glDisable(GL_LIGHTING);
/*glColor3f(0, 0, 1);
glutSolidCube(1);
glEnable(GL_LIGHTING);*/
/* glTranslatef(5, 0, 0);
drawGameField(true, 10);*/
//glutSolidTeapot(1.0);
//glRotatef(30,1.0,0.0,0.0);
glFlush ();
}
【问题讨论】: